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 & Performance with PhoneGap

Would running your scripts through the Closure Compiler make a difference in PhoneGap apps? Or does PhoneGap do something similar when you compile?
user154759
0
votes
1 answer

Skipping global variables conflicts in Closure Compier

I'm using HTML5 WebWorkers, and i faced such problem (while compiling my scripts with closure compiler): I have two files (.js) with this code inside: ... var encoder = null; ... In other words i have two global variables with the same…
bonbonez
  • 6,658
  • 2
  • 15
  • 16
0
votes
2 answers

How to document a type returned by a function (not constructor), and its methods

I'm using JsDoc3 and the Closure Compiler. I use a JsDoc template which outputs JSON for me to make HTML from it with a custom script. I have a function which returns a custom class (but I don't have, nor need, a constructor), and I want to be able…
0
votes
0 answers

Google Closure Library – Compilation Warnings

I've been using the Google Closure Compiler for a few years but I haven't played with the actual Closure Library that much. When I compile my app, I get the following warnings. The referenced code is in the library itself, not in my files. I'm…
J. K.
  • 8,268
  • 1
  • 36
  • 35
0
votes
3 answers

javascript codes refacting using ruby

Suppose I have some javascript code like this: function Person(){} var pro=Person.prototype; pro["setName"]=function(){} pro["setAge"]=function(){} .... Now,I will use the closure compiler to minify the source codes. However,since Closure Compiler…
hguser
  • 35,079
  • 54
  • 159
  • 293
0
votes
1 answer

compile two js files using closure compiler

I have two js files: 1.js (function(){ function setLength(a,len){ a.length=len; } ........... })(); 2.js: function View(){ setLength(this,3); } Note,the 2.js will access the method (setLength) defined in 1.js. So I want the compiler…
hguser
  • 35,079
  • 54
  • 159
  • 293
0
votes
1 answer

Eclipse Indigo with Closure

I installed correctly the plugin for CLOSURE, i followed the steps from here http://www.normalesup.org/~simonet/soft/ow/eclipse-closure-javascript.en.html and then when i try to do the first simple example helloword ->…
0
votes
2 answers

Minifier with GAE + Angular JS

Can you explain, or point to good resource on how to setup a minifier (preferably google closure) to work with Google App Engine. I use AngularJS for client side. So have bunch of JS files, and like to serve it as one, minified during production.…
bsr
  • 57,282
  • 86
  • 216
  • 316
0
votes
2 answers

Reconstructing code from closure compiler

I have two different versions of a javascript file: one works fine, the other performs slower. I've tried Closure Compiler on both files but... because I'm an idiot, after a few months I was happy to notice the original source file of the good…
Saturnix
  • 10,130
  • 17
  • 64
  • 120
0
votes
1 answer

how to fix closure compiler error on css({ float: 'left' })

Possible Duplicate: Google Closure Compiler parse error: invalid property id for css({float:'left'}) I tried to use closure compiler from http://closure-compiler.appspot.com/home to compile code // ==ClosureCompiler== // @output_file_name…
Andrus
  • 26,339
  • 60
  • 204
  • 378
0
votes
1 answer

google stylesheet compiler CSS renaming

Currently, I'm using Closure Compiler just on the javascript file. Now I also want to minify and rename the CSS classes with shorter names. Is there a way to avoid having to rewrite every jquery CSS string-based selector in my .js file (ie.…
frenchie
  • 51,731
  • 109
  • 304
  • 510
0
votes
1 answer

Choosing a Compile-to-JS language with output size as a priority

I'm currently working with a large-ish Javascript codebase (currently around 150k minified) which is being included on a bunch of websites. As more features have been added, it's been growing in size, so I'm now investigating ways in which the size…
Jim
  • 713
  • 1
  • 6
  • 23
0
votes
1 answer

Google Closure Compiler Parse Error

Possible Duplicate: Partially skip sections with Google Closure Compiler I get the following error from the compiler: Number of errors: 2 JSC_PARSE_ERROR: Parse error. syntax error at line 17 character 18 window.location =
S D
  • 135
  • 1
  • 11
0
votes
2 answers

Closure compiler number getting undefined in advanced optimization

I have the following line of code frame = self.spriteData['backgroundps.png']; self.bgBoard = new gg.casino.game.sprite(self.spriteSheet, frame, 0, 0, frame.w, frame.h); console.log(frame); console.log(self.bgBoard.x + ' ' + self.bgBoard.y + ' ' +…
saiy2k
  • 1,852
  • 1
  • 23
  • 42
0
votes
1 answer

Closure compiler not compiling all symbols

I am in the process of milking out every byte possible out of a library i am writing using the google closure compiler. The library consists of two files: The main library file The file i use to export my library's methods I am compiling with…
thanpolas
  • 848
  • 1
  • 8
  • 20