google-closure-compiler

Getting closure-compiler and Node.js to play nice

倾然丶 夕夏残阳落幕 提交于 2019-11-26 22:54:29
问题 Are there any projects that used node.js and closure-compiler (CC for short) together? The official CC recommendation is to compile all code for an application together, but when I compile some simple node.js code which contains a require("./MyLib.js") , that line is put directly into the output, but it doesn't make any sense in that context. I see a few options: Code the entire application as a single file. This solves the problem by avoiding it, but is bad for maintenance. Assume that all

Closure Compiler Warning `dangerous use of the global this object`?

南楼画角 提交于 2019-11-26 20:38:08
问题 Dear folks, Closure Compiler gives this warnings in Advanced Mode, underlining {this. JSC_USED_GLOBAL_THIS: dangerous use of the global this object at line 200 character 33 hovers[i4].onfocus = function() {this.className += "Hovered";} JSC_USED_GLOBAL_THIS: dangerous use of the global this object at line 201 character 32 hovers[i4].onblur = function() {this.className = this.className.replace(/Hove... JSC_USED_GLOBAL_THIS: dangerous use of the global this object at line 201 character 49 hovers

Does it make sense to minify code used in NodeJS?

Deadly 提交于 2019-11-26 18:05:44
问题 I was wondering, since Clojure Compiler and UglifyJS not only optimize code for size but also for performance (although I think size is the main priority), would my node.js app run faster if it was minified ? I know it may depend from app, but I'm asking this in general. 回答1: In node, the main processing cost is I/O operations, not the actual JavaScript itself. So for example: fs.readFile(myFile, function (err, data) { processTheFile(data); }); Here, the gap between calling readFile and the

jQuery compiled with Google Closure Compiler

こ雲淡風輕ζ 提交于 2019-11-26 09:36:18
问题 Has anyone compiled jQuery against Google\'s newly-released Closure compiler? There has been reported huge savings in code size. I\'m curious what the benefit is if jQuery was compiled with it. 回答1: John Resig reported a bug on recursive functions when he attempted to compile a nightly of jQuery 1.4, so there are a few kinks to be worked out. I wouldn't use a jQuery compiled with Closure Compiler without making sure it passes the jQuery testbed. http://code.google.com/p/closure-compiler