Open sdalu opened 3 years ago
Thanks for the suggestion! I’ve moved this to the features repository to keep track of it.
I got some code working in the Rules file to do this, but I'm inexperienced at ruby and this might be very very hacky:
module Nanoc::RuleDSL
class CompilationRuleContext < RuleContext
def minify_html
filter(
:external,
exec: 'minify',
options: [
'--type=html',
'--html-keep-document-tags',
],
)
nil
end
end
end
compile %r{^/pages/([^/]+)/index\.html\.erb$} do |slug,|
filter :erb
layout '/page.html.erb'
layout '/base.html.erb'
minify_html
write "/#{slug}/index.html"
end
When writing rules some of them can have a similar set of filter/layout/... it would be useful to provide a mechanism to reuse some block of code
For example: