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
2 answers

main() and Closure Compiler

I have some javascript that runs fine after being compiled through Closure with SIMPLE_OPTIMIZATIONS. But I would like to perform ADVANCED_OPTIMIZATIONS which performs dead code removal. After reading some relevant documentation here, I believe my…
newprogrammer
  • 2,514
  • 2
  • 28
  • 46
0
votes
1 answer

How can I enable header string literal declarations in Google Closure Compiler?

I've been using Google's closure compiler, and I've heard that Google is also using it in their products. Recently, I looked at Google Maps' compressed source code, and found out that string literals are pre-defined at the top. # I've beautified in…
Izumi Kawashima
  • 1,197
  • 11
  • 25
0
votes
1 answer

Google Closure, Response Always Empty

I'm trying to get together a basic example of how to use Google Closure to minify JS. I can't seem to get this to work at all. I'm trying to follow these…
VPel
  • 413
  • 5
  • 12
0
votes
1 answer

plovr warning on new closure .base()

I checked out the latest plovr and added closure to my project using bower. while compiling the code with closure-compiler.jar in advanced_compilation works without any error or warning, using plovr gives the following…
msin
  • 23
  • 1
  • 5
0
votes
1 answer

How to access method of parent class from within a 'same name' method of the child class, using google glosure?

I am building an API using google closure. I want to access a method of a superclass A, from within a method with the same name from the child class B. Please, see the following pseudo-code: Superclass A class A { move: function() { ...…
joaorodr84
  • 1,251
  • 2
  • 14
  • 33
0
votes
1 answer

Multiple level inheritance using google closure

I want to implement multiple inheritance using google closure. I have already researched and I found this book. At page 158, they say that google closure doesn't support multiple inheritance, but that there are other ways to do it, like using…
0
votes
1 answer

How to define constructor with closure and factory method with Google Closure

I'm trying to build a constructor function with the Google Closure library. To do so, I have a closure that return a factory method that export the constructor: (function(factory) { namespace.ui.Modal = factory(); })(function() { var Modal =…
Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134
0
votes
2 answers

How get grunt-closure-compiler to apply minimization to each file separately in a directory

Is there a way I can get grunt-closure-compiler to apply minimization to each file separately in a directory (overriding the original) instead of producing a single file as the output. If I can't override the original I am happy to place output…
Nikos
  • 7,295
  • 7
  • 52
  • 88
0
votes
1 answer

How can i detect user agent or browser in google closure compiler?

My Complier file is like that cd /d %~dp0 java -jar ../../../../file/css-compiler.jar --pretty-print ^ --allowed-unrecognized-property -khtml-opacity ^ ../source/abc.gss ^ > ../abc.css pause when i am adding following line in order to…
0
votes
1 answer

JSC_NOT_FUNCTION_TYPE google closure compiler

Is there a way to get rid of the warning JSC_NOT_FUNCTION_TYPE expressions are not callable while packaging javascript with google closure compiler ? var require = function(){}; var a=typeof require=="function"&& require; function hello(name)…
0
votes
0 answers

How do you make GCT compile not break a navbar?

Cannot really JSFiddle this, but this fiddle can give the idea: http://jsfiddle.net/xBc5a/ GCT = Google Closure Tools