Skip to content

Commit

Permalink
update to newer version of UglifyJS
Browse files Browse the repository at this point in the history
  • Loading branch information
scribu committed Apr 22, 2013
1 parent e305835 commit ef2911d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions Cakefile
Expand Up @@ -2,6 +2,7 @@ fs = require('fs')
path = require('path')
mkdirp = require('mkdirp').sync
{spawn, exec} = require('child_process')
UglifyJS = require('uglify-js')

io = (callback, inputPath, outputPath) ->
mkdirp path.dirname outputPath
Expand All @@ -14,14 +15,6 @@ io = (callback, inputPath, outputPath) ->
callback input, (output) ->
fs.writeFileSync outputPath, output, 'utf8'

compress_js = (input, cb) ->
{parser, uglify} = require('uglify-js')

ast = parser.parse input
ast = uglify.ast_squeeze ast

cb uglify.gen_code ast

launch = (cmd, options=[], callback) ->
app = spawn cmd, options
app.stdout.pipe(process.stdout)
Expand All @@ -46,7 +39,8 @@ task 'build:js', 'Generate compressed JS', (options) ->
exec 'cd coffee; cat core.coffee hover.coffee init.coffee fields/*.coffee | coffee -cs > ../build/editor.js', (err, stdout, stderr) ->
throw err if err

io compress_js, 'build/editor.js', 'build/editor.min.js'
result = UglifyJS.minify('build/editor.js')
fs.writeFileSync 'build/editor.min.js', result.code, 'utf8'

task 'build:aloha', 'Generate Aloha plugin(s)', (options) ->
plugin = 'wpImage'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "front-end-editor",
"version": "0.0.0",
"dependencies": {
"uglify-js" : ">=1.2.0",
"mkdirp" : ">=0.3.0"
"uglify-js": "~2.2.5",
"mkdirp": "~0.3.5"
}
}

0 comments on commit ef2911d

Please sign in to comment.