我正在使用Jekyll Asset Pipeline来构建我的网站,我只想在发布网站时压缩网站(大约需要 20 秒)。为此,我必须在配置文件中以编程方式启用这些值:
asset_pipeline:
bundle: false
compress: false
我试图编写一个插件,但它不工作。有人可以帮我解释为什么吗?
module Jekyll
module Commands
# I overwrite this here so we only do heavy work (like compressing HTML and stuff)
# when we are building the site, not when testing (which uses jekyll serve)
class << Build
alias_method :_process, :process
def process(options)
require 'jekyll-press'
options['asset_pipeline']['bundle'] = true
options['asset_pipeline']['compress'] = true
_process(options)
end
end
end
end