Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (36 sloc) 1.14 kb
var fs = require('fs');
var sys = require('sys');
var uglify = require('uglify');
var jsp = uglify.parser;
var pro = uglify.uglify;
desc("build restfulie into one file");
task('default',['clean', 'build'], function(){
console.log('Building Restfulie...');
});
desc('do the bizness');
task('build', [], function(){
var lib = fs.readdirSync('client/lib/');
var originalJSContent = [];
for(var i = 0; i < lib.length; i++){
if(lib[i].match('.swp')) {continue}
console.log("appending " + lib[i]);
var data = fs.readFileSync('client/lib/' + lib[i]);
fs.createWriteStream('restfulie.js', {'flags' : 'a'}).write(data);
originalJSContent.push(data);
}
var js = originalJSContent.join('');
var ast = jsp.parse(js);
ast = pro.ast_mangle(ast);
ast = pro.ast_squeeze(ast);
var compressedJS = pro.gen_code(ast);
fs.createWriteStream('restfulie.min.js', {'flags' : 'a'}).write(compressedJS);
});
desc('clean the artifacts');
task("clean", [], function(){
try{
fs.unlinkSync('restfulie.js');
fs.unlinkSync('restfulie.min.js');
}catch(e){
console.log("couldn't clean the artifacts...");
}
});
Jump to Line
Something went wrong with that request. Please try again.