Skip to content

Commit

Permalink
Added minified version
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgtonge committed Jan 24, 2012
1 parent f4d6acd commit 4ded456
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Cakefile
@@ -1,5 +1,6 @@
fs = require 'fs'
{exec} = require 'child_process'
uglify = require './node_modules/uglify-js'


task 'build', 'Build JS files from Coffee sources', ->
Expand All @@ -10,4 +11,17 @@ task 'build', 'Build JS files from Coffee sources', ->

exec 'coffee -c test/backbone-query-test.coffee', (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
console.log stdout + stderr

task 'uglify', 'Minify and obfuscate', ->
jsp = uglify.parser
pro = uglify.uglify

contents = fs.readFileSync "js/backbone-query.js", 'utf8'

ast = jsp.parse contents # parse code and get the initial AST
ast = pro.ast_mangle ast # get a new AST with mangled names
ast = pro.ast_squeeze ast # get an AST with compression optimizations
final_code = pro.gen_code ast # compressed code here

fs.writeFile 'js/backbone-query.min.js', final_code
1 change: 1 addition & 0 deletions js/backbone-query.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ded456

Please sign in to comment.