forked from Flotype/now
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add minified now.js client lib and serve it + build process
- Loading branch information
Showing
7 changed files
with
55 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
build: | ||
@node ./bin/build_now.js; | ||
@node ./bin/build.js; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
|
||
}); | ||
}); | ||
|
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.