google-closure-compiler

Any ideas on how to use Google Closure Compiler to combine multiple javascript files w/o any optimizations?

爷,独闯天下 提交于 2019-12-01 05:16:46
Any ideas on how to use Google Closure Compiler to combine multiple JavaScript files w/o any optimizations? Specifically, we want to use Closure to deploy two versions of our combined site JavaScript: release and debug. For release, we are using --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies which is working as intended. However, for debug, we would like our JavaScript to be combined intact/unmodified for easier debugging. It seems the minimum level of optimization is WHITESPACE_ONLY , any ideas would be appreciated. --formatting PRETTY_PRINT for beautifying --debug

Can I tell the Closure compiler to, for specific types only, stop renaming properties?

爱⌒轻易说出口 提交于 2019-12-01 04:16:47
This question follows: Why does Closure compiler rename properties of an extern type? John's answer to that question brings up this second question. If I declare the extern type as suggested: /** @interface */ function SpanishNoun() {} /** @type {string} */ SpanishNoun.prototype.english; /** @type {string} */ SpanishNoun.prototype.spanish; then Javascript like: /** * @param {SpanishNoun} n */ exp.foo = function (n) { console.log(n.english, n.spanish, n['english'], n['spanish']); } will compile, as desired, to: function(a){console.log(a.english,a.spanish,a.english,a.spanish)}; The properties

Can I tell the Closure compiler to, for specific types only, stop renaming properties?

天大地大妈咪最大 提交于 2019-12-01 01:22:33
问题 This question follows: Why does Closure compiler rename properties of an extern type? John's answer to that question brings up this second question. If I declare the extern type as suggested: /** @interface */ function SpanishNoun() {} /** @type {string} */ SpanishNoun.prototype.english; /** @type {string} */ SpanishNoun.prototype.spanish; then Javascript like: /** * @param {SpanishNoun} n */ exp.foo = function (n) { console.log(n.english, n.spanish, n['english'], n['spanish']); } will

How does Google Closure Compiler handle quotes (string literals)?

雨燕双飞 提交于 2019-12-01 00:40:48
The question 'How does Google Closure Compiler handle quotes (string literals)?' could also be re-phrased like: Why does Closure replace/swap single quotes with double quotes? How does Closure decide what quote- formatting/style to use? (How) can I change this (default) behavior? Note 1: this question is not about why Closure (or some other minifiers) have chosen to prefer double quotes (as is asked here and here ). Note 2: this question is not about single vs double quote discussions, however some understanding what GCC does to our code (and why) is rather useful! It is often stated that (or

Suppressing or resolving compiler errors in goog.base

萝らか妹 提交于 2019-11-30 23:07:50
I use Closure Compiler on my sources and recently decided to enable the most strict mode via --jscomp_warning=reportUnknownTypes . Alas, it triggered a lot of warnings inside the goog.base itself! I've fixed all the problems in my own code and now I'm looking for a way to silence/remove errors in the closure library code. I tried to fix errors in base.js but quickly realized it's unfeasible. There are approximately 108 errors in the file and in most cases they are real errors because of goog.base doesn't care much about types: it's a common practice there to define a type like {?} or {*} . I

Suppressing or resolving compiler errors in goog.base

倾然丶 夕夏残阳落幕 提交于 2019-11-30 19:27:31
问题 I use Closure Compiler on my sources and recently decided to enable the most strict mode via --jscomp_warning=reportUnknownTypes . Alas, it triggered a lot of warnings inside the goog.base itself! I've fixed all the problems in my own code and now I'm looking for a way to silence/remove errors in the closure library code. I tried to fix errors in base.js but quickly realized it's unfeasible. There are approximately 108 errors in the file and in most cases they are real errors because of goog

Why does Closure compiler rename properties of an extern type?

谁说我不能喝 提交于 2019-11-30 17:46:07
I put this in an externs file: /** @typedef {{english: string, spanish: string}} */ var SpanishNoun; Then I have javascript: /** * @param {SpanishNoun} n */ exp1.processData3 = function (n) { console.log("pd3:", n.english, n.spanish, n['english'], n['spanish']); } Which compiles to: function(a){console.log("pd3:",a.a,a.c,a.english,a.spanish)}; So it still renamed 'english' to 'a', etc. How do you stop that? Why does it think it can rename something that is "extern". Rob Follow-up Question John's answer led to another question: Can I tell the Closure compiler to, for specific types only, stop

How are javascript class names calculated for custom classes in Chrome Dev Tools?

依然范特西╮ 提交于 2019-11-30 15:49:06
问题 I am trying to determine the rules for generating class names in javascript. I pasted this script into Chrome dev tools console: var obj = { Constr : function() { } }; var obj2 = obj; console.log(new obj.Constr()); console.log(new obj2.Constr()); obj2.Constr2 = function() { }; console.log(new obj.Constr2()); console.log(new obj2.Constr2()); And here are the results in the console: obj.Constr obj.Constr obj2.Constr2 obj2.Constr2 It seems that the name of the class is determined by the variable

Using Google Closure compiler [duplicate]

 ̄綄美尐妖づ 提交于 2019-11-30 15:03:15
Possible Duplicate: jQuery compiled with Google Closure Compiler I am using jQuery and I have all of my JS code in application.js file. When I compile "application.js" with the Google Closure compiler (using the advance options) I get a js file with no errors and warning. However, I am unable to use the file in my page, I get an error on page load which says "TypeError: Result of expression '$("div.tile").d' [undefined] is not a function." My question is can I compile a js file which uses jQuery? Yes, if you care to include the jQuery file in with your other file. Yes, if you use simple mode,

How are javascript class names calculated for custom classes in Chrome Dev Tools?

强颜欢笑 提交于 2019-11-30 14:53:15
I am trying to determine the rules for generating class names in javascript. I pasted this script into Chrome dev tools console: var obj = { Constr : function() { } }; var obj2 = obj; console.log(new obj.Constr()); console.log(new obj2.Constr()); obj2.Constr2 = function() { }; console.log(new obj.Constr2()); console.log(new obj2.Constr2()); And here are the results in the console: obj.Constr obj.Constr obj2.Constr2 obj2.Constr2 It seems that the name of the class is determined by the variable that the constructor function was originally assigned to. I am looking for the precise rules that CDT