Questions tagged [google-closure-compiler]

Google Closure Compiler compiles a typed superset of modern JavaScript to a target version of JavaScript, applying type checking, dead code elimination, minification and other improvements.

The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.

The Closure Compiler has three optimization modes: whitespace only, simple optimizations, and advanced optimizations. The first two are safe for all JavaScript. The latter one imposes restrictions on JavaScript usage, but it is where Closure Compiler shines and the valuable type checking, dead code removal, and better minification.

1178 questions
0
votes
1 answer

Closure compiler warns about undefined property from extern

The closure compiler a warning about a property that isn't defined on an extern when as far as I can tell the property is defined on that extern. I would like to get the closure compiler to compile this cleanly without issuing this warning. I am…
garethm
  • 2,163
  • 17
  • 27
0
votes
1 answer

How do I enable logging for Google Closure Compiler?

Google's Closure Compiler has this flag for logging: --logging_level VAL The logging level (standard java.util.logging.Level values) for Compiler progress. Does not control errors or warnings for the JavaScript code under…
TachyonVortex
  • 8,242
  • 3
  • 48
  • 63
0
votes
1 answer

Google Closure library as a flowchart constructor

So I am very interested in using the closure libraries more at my workplace, but my boss is telling me it seems "too scattered and complicated to use". His main concern is that it won't be able to replace our workflow constructor and I have searched…
0
votes
1 answer

Does anyone know if the source code for http://closure-compiler.appspot.com/home is available?

Does anyone know if the source code for http://closure-compiler.appspot.com/home is available? I am trying to call Google Closure Compiler from a Java application and I'm thinking that if the source code for the service above would be available…
daniels
  • 18,416
  • 31
  • 103
  • 173
0
votes
2 answers

Google Closure Compiler - How to set externs?

How do I set up closure compiler annotation / externs to compile the following properly? var ac, volumeNode; var load_sound = true; var contextClass = (window.AudioContext || window.webkitAudioContext || window.mozAudioContext || …
user3117610
  • 137
  • 2
  • 8
0
votes
0 answers

Google closure compiler does some strange stuff with my js files

I have written a small js script that will provide a booking var for my other scripts. Small excerpt of script: var booking={ venue: null, baseUrl: "http://fancy.url.com", align: "right", top: "200px", image: null, id: 0, …
jakob
  • 5,979
  • 7
  • 64
  • 103
0
votes
1 answer

Best way of structuring js and css files in my play2 app

I'm trying to understand how I should structure my js and css files in my app. If I look at the anotomy of a play2 app: app → Application sources └ assets → Compiled asset sources └ stylesheets →…
0
votes
1 answer

Concatenating javascript files using closure compiler

I am trying to use Closure compiler to concatenate javascript files - possibly before code optimization for better results in code optimization. I am new to closure and I cant find a way to concatenate js files with closure. I would love it if its…
EternallyCurious
  • 2,345
  • 7
  • 47
  • 78
0
votes
1 answer

How to add a reserved word for closure compiler

Reserved words such as fill and stroke never get renamed. Is there a way to add to this list? (This is so that a common property name which is actually used by the browser is not renamed. Adding something to the externs file would be my preferred…
Dere_2929
  • 365
  • 3
  • 9
0
votes
1 answer

Play 2.2 minify javascripts

How to tell Play to compile and create a minified version of my.js? After running 'play stage', I can't find it anywhere under target/scala-2.10/resource_managed or target/scala-2.10/classes. app/ assets/ javascripts/ main/ …
angelokh
  • 9,426
  • 9
  • 69
  • 139
0
votes
2 answers

How i can mark function as "private" to renaming it by Google Closure Compiler?

I have private function createSomething(): function Player(id) { /** * Creates stuff * @private */ this.createSomething = function() { // do something good }; } and I want to see the renamed function "createSomething()" after…
Vlad
  • 442
  • 5
  • 15
0
votes
1 answer

Extjs 3.4 not fully working in GateIn 3.6 - Closure compiler compression issue

I am using ext-js version 3.4 with GateIn 3.6 (jboss as 7). On GateIn some ext components are not working fine (especially tree) when GateIn as in production mode. I think this issue is due to javascript compression mechanism. I got the same issue…
Anish Antony
  • 875
  • 3
  • 17
  • 35
0
votes
1 answer

What syntax I should use to declare externs for closure compiler?

I want to declare some externs for closure compiler but not know how to do it? (function(window) { window.myapi = window.myapi || {}; var myapi = window.myapi; myapi.hello = function() { window.document.write('Hello'); } }(window)); I am not…
Chameleon
  • 9,722
  • 16
  • 65
  • 127
0
votes
1 answer

Closure Compiler cannot read a directory

I want to compile some JS files inside a folder using the closure compiler, the issue I am facing is that when I am trying to compile the files in a folder(which contains JS files) whose name has got a whitespace, the closure compiler breaks and…
0
votes
2 answers

Error while compiling on closure-compiler

I want take shorten my JS, but Errors appear while compiling. Error warning from points like : default = { Home:'', Max: 5, } or items: { visible: 1, width: 200 } Waring Msg : JSC_TRAILING_COMMA: Parse error. IE8…
Hai Tien
  • 2,929
  • 7
  • 36
  • 55