Class: Awestruct::Extensions::Minify
- Inherits:
-
Object
- Object
- Awestruct::Extensions::Minify
- Defined in:
- lib/awestruct/extensions/minify.rb
Instance Method Summary collapse
-
#initialize(types = [ :css, :js ]) ⇒ Minify
constructor
A new instance of Minify.
- #transform(site, page, input) ⇒ Object
Constructor Details
#initialize(types = [ :css, :js ]) ⇒ Minify
Returns a new instance of Minify.
54 55 56 |
# File 'lib/awestruct/extensions/minify.rb', line 54 def initialize(types = [ :css, :js ]) @types = types end |
Instance Method Details
#transform(site, page, input) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/awestruct/extensions/minify.rb', line 58 def transform(site, page, input) if site.minify ext = File.extname(page.output_path)[1..-1].to_sym if @types.include?(ext) case ext when :html print "minifying html #{page.output_path}" htmlcompressor(page, input, site.minify_html_opts) when :css print "minifying css #{page.output_path}" yuicompressor(page, input, :css) when :js print "minifying js #{page.output_path}" yuicompressor(page, input, :js) when :png print "minifying png #{page.output_path}" pngcrush(page, input) else input end else input end else input end end |