Bundled minifier utilities for Node, designed primarily for use with the Ender CLI.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 15 commits behind ender-js:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
support
test
.gitignore
.jshintrc
Makefile
README.md
buster.js
package.json

README.md

ender-minify

Bundled minifier utilities for Node, designed primarily for use with the Ender CLI.

UglifyJS

var fs = require('fs')
var em = require('ender-minify')
var options = {} // no options for UglifyJS at the moment

fs.readFile('source.js', 'utf-8', function (err, source) {
  if (err) throw err

  em.minify('uglify', source, options, function (err, minifiedSource) {
    if (err) throw err

    fs.writeFile('source.min.js', minifiedSource, 'utf-8')
  })
})

Closure Compiler

var fs = require('fs')
var em = require('ender-minify')
var options = {
  level: 'simple',                 // can be 'whitespace', 'simple' or 'advanced'
  externs: [ 'foo.js', 'bar.js' ]  // passed as --externs
}

fs.readFile('source.js', 'utf-8', function (err, source) {
  if (err) throw err

  em.minify('closure', source, options, function (err, minifiedSource) {
    if (err) throw err

    fs.writeFile('source.min.js', minifiedSource, 'utf-8')
  })
})

YUICompressor coming soon...