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
-1
votes
1 answer

How to use the Google Closure Compiler to browserify your Node.js library

I have this simple Node.js library: mylib/ |- inc.js |- index.js |- is_number.js |- package.json mylib/is_number.js module.exports = x => typeof x === 'number'; mylib/inc.js const is_number = require('./is_number'); module.exports = x =>…
customcommander
  • 17,580
  • 5
  • 58
  • 84
-1
votes
1 answer

How can I reduce the size of an Angularjs site using Google Closure Compiler?

How can I reduce the size of an Angularjs site using Google Closure Compiler? I have a site on Angularjs 1.8. x, but I want to compile it using Closure. How can this be done? If there are ready-made examples and demos? 'use strict'; // Declare app…
-1
votes
1 answer

google closure compiler ignoring source_map_input

I have a quite complex build system and I'm trying to create a source map based on specific files. Those files have been concatenated previously and they also have a source map. Now this is the scenario: Files a, b, and c are concatenated into…
-1
votes
2 answers

Invoke closure whenever js file is changed

I am using google-closure-compiler and gulp to minify my angularjs files. Here is my gulpfile code; var closureCompiler = require('google-closure-compiler').gulp(); var flatmap = require('gulp-flatmap'); var path =…
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
-1
votes
1 answer

If I use Google Closure, do I need to worry about absolute equality?

I was presented with this argument when fixing a bug related to implicit casting and speaking to the developer who told me: If you use Closure, then you do not need absolute equality. Any value would be typed, therefor you don't need to worry about…
Tim Consolazio
  • 4,802
  • 2
  • 19
  • 28
-1
votes
1 answer

What tool outputs this format? Google Closure compiler?

Looking at some javascript code on someone's website, I see this. 12: [function(t, e, n) { ... },{}] And then elsewhere in the file, the function is called this way. loader: [function(t, e, n) { ... t(12); ... }, {}] I…
user2171796
  • 397
  • 2
  • 16
-1
votes
1 answer

Google Closure Compiler JSDoc annotations in Sublime Text or Atom editor

Does Sublime Text or Atom editor have plugin for Google Closure Compiler JSDoc annotations? Especially, code completions or error checking features like in WebStorm?
Matt
  • 8,195
  • 31
  • 115
  • 225
-1
votes
1 answer

Advanced Closure Compatibility and static types - Usage of types like undefined and global functions like localStorage.getItem();

I'm just wondering whats the correct way to check if a function is undefined with a script which will be closured in advanced mode and how to access global functions? E.g. an example of checking if google analytics is loaded: typeof window["ga"] ==…
Manuel
  • 9,112
  • 13
  • 70
  • 110
-1
votes
2 answers

extract part of the path to file or "/" if it doesn't exist

Okay guys here are my 2 strings D:/path/to/project/js/folder/LVL1/LVL2/mylibrary.js and D:/path/to/project/js/folder/mylibrary.js for the first I want to get /LVL1/LVL2 and for the second i want to get a slash / here is my regex…
Nani
  • 317
  • 5
  • 15
-1
votes
1 answer

What does this .jar file named Closure Compiler do?

I was looking through a repo on Github and I came across a curious folder called "closure", which had a .jar file comprised of nearly 400k lines of this: 504b 0304 0a00 0008 0000 7a57 1a43 0000 0000 0000 0000 0000 0000 0900 0400 4d45 5441 2d49 4e46…
Bella I.
  • 3
  • 1
-1
votes
1 answer

Parsing PHP that's mixed with JS for google closure compiler

I was wondering if there are any parsers/tools to take out (and I guess substitute place holders) so that JS code that has PHP intermingled with it can be parsed by the google closure compiler tool. If not, maybe someone has a clever idea (short of…
purify
  • 1
-1
votes
1 answer

Process.Start "C:\Windows\System32\java.exe"' not recognized as an internal or external command

Using process.start to run a batch file. This batch file runs perfectly when double clicking. When execuiting through process.start it gives below error, have tried process.start cmd /c batfile.bat and this does not work…
user3231982
  • 45
  • 1
  • 2
  • 5
-1
votes
1 answer

Why closure compile not use externs (var x = {} and need window.x = {})?

I prepare three files: java -jar compiler.jar --js=utf8.js --js_output_file=utf8-advanced.js --charset=utf8 --compilation_level=ADVANCED_OPTIMIZATIONS --formatting=SINGLE_QUOTES --formatting=PRETTY_PRINT --externs=externs.js…
Chameleon
  • 9,722
  • 16
  • 65
  • 127
-1
votes
2 answers

Closure Compiler - List all the externs used?

I am new to Closure Compiler and when I compile a library I have to work with, a line like this intrigues me: [jscomp] Compiling 197 file(s) with 41 extern(s) I'd say some common Web variables like document and window are in, but do I have a way…
kennyluck
  • 89
  • 1
  • 3
-1
votes
2 answers

Are there compilers for HTML/CSS?

Many people today use Google Closure Compiler to actually "compile" their JavaScript code. The advanced mode enables it to rewrite JS to better, faster and smaller JS-code that functions the same way as the original input. Are there any good…
1 2 3
78
79