google-closure-compiler

How to prevent Closure Compiler from renaming “true”, “false” and “null”

…衆ロ難τιáo~ 提交于 2019-12-04 23:33:13
问题 Google Closure Compiler renames all "true", "false" and "null" occurences in code like; var s = true, x = null, V = false; and uses these shorthands instead; in conditions such as; if (someVariable == s) now; Google Analytics code defines it's own "s" variable; overriding the value "true"; and as you can see this causes a lot of problems. I don't want to change GA code; I just want Closure Compiler to quit renaming true etc. Externs do not work. Do you know any way to accomplish this? 回答1: It

compress all js in a folder to new folder useing google closure compiler?

馋奶兔 提交于 2019-12-04 16:46:47
how can i compress all my js in a folder to a new folder ? i have search around google and stackoverflow, what i found is just Compress all file .js with Google Closure Compiler Application in one File that puting it all to one.. + can we put a wildcard or something? so i can do something like java -jar bin/compiler.jar ../../path/my/*.js --js_output_file ../../path/new/*.js thanks for looking in Adam Ramadhan Bash scripting to the rescue. Something like files=`find ../../path/my -name "*.js"` for i in $files; do java -jar bin/compiler.jar $i --js_output_file `dirname $i`../new/$i.js done (not

Google Closure decompiler?

 ̄綄美尐妖づ 提交于 2019-12-04 15:39:11
I was looking for a way to decompile JavaScript that was compiled by Google Closure. I did find a Decompiler class ( https://code.google.com/p/closure-compiler/source/browse/lib/rhino/src/org/mozilla/javascript/Decompiler.java?name=v20140407 ), however I haven't had much luck with it. Anyone try this before or know of some other method? Usually, I just run the code through the Closure Compiler in WHITESPACE mode and enable the pretty printing options. 来源: https://stackoverflow.com/questions/9321648/google-closure-decompiler

google closure compile jQuery Plugin

好久不见. 提交于 2019-12-04 13:29:21
问题 I'm testing google closure-compiler and wanting to compile facebox Plugin with the option "Advanced" , an error occurs the function trying to find "a.H". Has anyone tried to compile with this option jQuery plugins with a good result. Thank you. EDIT: Clearly this re-naming the jQuery methods, but is it possible to include jQuery and re-name all methods equally?. EDIT example of code with the option "externs_url": with closure-compiler js input code // ==ClosureCompiler== // @output_file_name

google closure compiler and json

半腔热情 提交于 2019-12-04 10:54:51
问题 I have a json string that I parse and then access the properties of the object with the dot notation. However, in the google closure compiler, the dot notation ( MyObject.PropertyName ) gives warning that the property isn't defined. For now, the solution I'm using is to convert my code into bracket notation ( MyObject['PropertyName'] ). This removes the warning but also prevents the compiler from doing its job. On the other hand, when I write JSON.stringify(MyObject) , the server receives a

How can I easily maintain a cross-file JavaScript Library Development Environment

孤街浪徒 提交于 2019-12-04 10:49:56
I have been developing a new JavaScript application which is rapidly growing in size. My entire JavaScript Application has been encapsulated inside a single function, in a single file, in a way like this: (function(){ var uniqueApplication = window.uniqueApplication = function(opts){ if (opts.featureOne) { this.featureOne = new featureOne(opts.featureOne); } if (opts.featureTwo) { this.featureTwo = new featureTwo(opts.featureTwo); } if (opts.featureThree) { this.featureThree = new featureThree(opts.featureThree); } }; var featureOne = function(options) { this.options = options; }; featureOne

How to indicate param is optional using inline JSDoc?

我们两清 提交于 2019-12-04 07:35:44
问题 According to the JSDoc wiki for @param you can indicate a @param is optional using /** @param {String} [name] */ function getPerson(name) { } and you can indicate a param inline using function getPerson(/**String*/ name) { } And I can combine them like the following, which works ok. /** @param [name] */ function getPerson(/**String*/name) { } But I would like to know if there is a way to do it all inline if possible. 回答1: From official documentation: Optional parameter An optional parameter

How to make angular decorators minification friendly?

孤街浪徒 提交于 2019-12-04 05:20:41
How to can I make this code that I have minification friendly? MyModule.config(['$provide',function($provide) { $provide.decorator("$exceptionHandler", function($delegate,$injector) { I can't seem to do this: $provide.decorator("$exceptionHandler" , "$delegate","$injector", function($delegate,$injector) { You are missing the [ . The pattern is the same that you successfully applied for config : $provide.decorator("$exceptionHandler" , [ "$delegate","$injector", function($delegate,$injector) { 来源: https://stackoverflow.com/questions/23946996/how-to-make-angular-decorators-minification-friendly

How do I use Google Closure compiler to remove unused JavaScript code?

有些话、适合烂在心里 提交于 2019-12-04 03:28:43
How do I use Google Closure compiler to remove unused code? I am using the JQuery Slider control but am not using anything else within JQuery. So I read that Google Closure compiler in Advanced mode can remove unused code, but I don't know how . I have frontpage.html that links to an external JQuery, JQuery UI and JQuery Slider control from that html page hosted on my site. On my frontpage.html, I also have JavaScript embedded within the HTML that initiates the JQuery Slider control. How do I use I use the online Closure Compiler to evaluate my frontpage.html, JQuery, JQuery UI, and JQuery

WARNING - dangerous use of the global this object

若如初见. 提交于 2019-12-04 03:15:45
问题 In Google Closure Compiler I get the warning WARNING - dangerous use of the global this object Here is an example. The error line and offset refers to the beginning of the word this function aToggle() { if(shown) toggle.show() else toggle.hide() $(this).text(shown ? 'Click to hide' : 'Click to show') shown = !shown } link.onclick = aToggle I would just change it to an anonymous method, but I am re-using aToggle elsewhere in the file, so it needs to be named. I could mark aToggle as /**