Permalink
Browse files

add minified now.js client lib and serve it + build process

  • Loading branch information...
ericz committed Jan 16, 2012
1 parent 176050b commit ef1cc3486baaea9edc089cd8b26d5259feaef1f9
Showing with 55 additions and 69 deletions.
  1. +1 −1 Makefile
  2. +41 −0 bin/build.js
  3. +0 −44 bin/build_now.js
  4. +2 −0 dist/now.js
  5. +0 −2 lib/dist/now.js
  6. +9 −21 lib/fileServer.js
  7. +2 −1 lib/now.js
View
@@ -1,3 +1,3 @@
build:
- @node ./bin/build_now.js;
+ @node ./bin/build.js;
View
@@ -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");
+
+ });
+});
+
View
@@ -1,44 +0,0 @@
-/*
- * 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.%ext% build:' + package.version + ', %type%. Copyright(c) 2011 Flotype <team@flotype.com> MIT Licensed */\n'
- , development = template.replace('%type%', 'development').replace('%ext%', 'js')
- , production = template.replace('%type%', 'production').replace('%ext%', 'min.js');
-
-
-
- //array base containing all the files to be read.
- 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;
- var code = content.toString();
- var ast = jsp.parse(code);
- ast = pro.ast_squeeze(ast, {make_seqs: false, dead_code: false});
- var code = production + pro.gen_code(ast, {ascii_only: true});
-
- code += ';';
- fs.write(
- fs.openSync(__dirname + '/../lib/dist/now.js', 'w')
- , code
- , 0
- , 'utf8'
- );
-
- });
- });
-
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit ef1cc34

Please sign in to comment.