Speed up compilation of html pages in production (#401)

* speed up compilation of html pages in production

* who needs all of that latex

* add latex-fonts-recommended

* math package

* how far can we push this

* just trimming off some little excess

* never mind, good enough
This commit is contained in:
lorin 2020-08-26 11:44:49 +02:00 committed by GitHub
parent 9f7d879236
commit 176139da59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View file

@ -18,7 +18,9 @@ cache:
addons: addons:
apt: apt:
packages: packages:
- texlive-full - texlive-latex-base
- texlive-math-extra
- texlive-xetex
- lmodern - lmodern
branches: branches:

View file

@ -5,12 +5,12 @@ GEM
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
adsf (1.4.3) adsf (1.4.3)
rack (>= 1.0.0, < 3.0.0) rack (>= 1.0.0, < 3.0.0)
autoprefixer-rails (9.8.6.1) autoprefixer-rails (9.8.6.3)
execjs execjs
builder (3.2.4) builder (3.2.4)
coderay (1.1.3) coderay (1.1.3)
colored (1.2) colored (1.2)
concurrent-ruby (1.1.6) concurrent-ruby (1.1.7)
cri (2.15.10) cri (2.15.10)
ddmemoize (1.0.0) ddmemoize (1.0.0)
ddmetrics (~> 1.0) ddmetrics (~> 1.0)
@ -121,7 +121,7 @@ GEM
terminal-notifier-guard (1.7.0) terminal-notifier-guard (1.7.0)
thor (1.0.1) thor (1.0.1)
tomlrb (1.3.0) tomlrb (1.3.0)
tty-color (0.5.1) tty-color (0.5.2)
tty-command (0.9.0) tty-command (0.9.0)
pastel (~> 0.7.0) pastel (~> 0.7.0)
tty-platform (0.3.0) tty-platform (0.3.0)

View file

@ -1,5 +1,14 @@
require 'htmlcompressor' require 'htmlcompressor'
require 'rainpress'
require 'uglifier'
class UglifyProxy < Uglifier
alias_method :compress, :compile
end
JS_COMPRESSOR = UglifyProxy.new
CSS_COMPRESSOR = Rainpress
Nanoc::Filter.define(:html_press) do |content, options| Nanoc::Filter.define(:html_press) do |content, options|
HtmlCompressor::Compressor.new(compress_javascript: true, compress_css: true, remove_quotes: true, simple_boolean_attributes: true).compress content HtmlCompressor::Compressor.new(compress_javascript: true, javascript_compressor: JS_COMPRESSOR, compress_css: true, css_compressor: CSS_COMPRESSOR, remove_quotes: true, simple_boolean_attributes: true).compress content
end end