Skip to content

Commit

Permalink
add minified now.js client lib and serve it + build process
Browse files Browse the repository at this point in the history
  • Loading branch information
ericz committed Jan 16, 2012
1 parent 176050b commit ef1cc34
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build:
@node ./bin/build_now.js;
@node ./bin/build.js;

41 changes: 41 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Module dependencies.
*/
var fs = require('fs')
, package = JSON.parse(fs.readFileSync(__dirname + '/../package.json'))
, jsp = require("uglify-js").parser
, pro = require("uglify-js").uglify;



var template = '/*! now.js build:' + package.version + '. Copyright(c) 2011 Flotype <team@flotype.com> MIT Licensed */\n'

var base = ['now.js'];
var files = [];
base.forEach(function (file) {
files.push(__dirname + '/../lib/client/' + file);
});

var results = {};
files.forEach(function (file) {
fs.readFile(file, function (err, content) {

if (err) throw err;
console.log("y");
var code = content.toString();
var ast = jsp.parse(code);
ast = pro.ast_squeeze(ast, {make_seqs: false, dead_code: false});
var code = template + pro.gen_code(ast, {ascii_only: true});

code += ';';
fs.write(
fs.openSync(__dirname + '/../dist/now.js', 'w')
, code
, 0
, 'utf8'
);
console.log("z");

});
});

44 changes: 0 additions & 44 deletions bin/build_now.js

This file was deleted.

2 changes: 2 additions & 0 deletions dist/now.js

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

Loading

0 comments on commit ef1cc34

Please sign in to comment.