Skip to content

Commit

Permalink
Enable options forwarding for uglify and csso minifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobeat committed May 18, 2013
1 parent ca22dd2 commit 83d0566
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions adapters/minifiers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ module.exports = new Adapter

js: (file, cb) ->
uglify = require 'uglify-js'

options = Adapter.getOptions this
options.fromString = true

file.read (code) ->
if uglify.minify? # uglify > 2.0
res = uglify.minify(code, { fromString: true }).code
res = uglify.minify(code, options).code
else # old API
{ parser: jsp, uglify: pro } = uglify
res = pro.gen_code pro.ast_squeeze pro.ast_mangle jsp.parse code
cb res

css: (file, cb) ->
csso = require 'csso'

options = Adapter.getOptions this, {
restructure: false
}

file.read (code) ->
res = csso.justDoIt code
res = csso.justDoIt code, options.restructure
cb res

0 comments on commit 83d0566

Please sign in to comment.