I have a lot of time invested in jquery and a large application built with it. Recently I've been reviewing Google Closure Library, but at this time have found it to be not nearly as elegant as jquery. I believe it may have some potential and will look into it more, but for now I intend to continue using jQuery as my base framework.
How...
Does anybody know how to integrate Google closure compiler with Eclipse IDE? The thing I was trying to do is to configure Google closure compiler as a external tool for Eclipse IDE. Then I would be able to run closure compiler within IDE and minify my Javascript files with single click.
Have anybody solved this problem yet?
...
My markup:
<script src="http://somecdn.com/jquery-1.4.2.min.js"></script>
<script src="/js/mycode.closure_compiled.js"></script>
My code:
goog.provide("mycode");
mycode.foo = function () {
jQuery("#ajaxSpinner").show();
jQuery.get("/ajax/foo", function () { /* ... */ });
}
I want to compile my code with advanced o...
I was reading http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml when I noticed in the Constant section with the annotated comments:
/**
* The number of seconds in each of the given units.
* @type {Object.<number>}
* @const
*/
and then the guide goes on with "This allows the compiler to enforce constant-ness."
...
Say I had 1 MB of compressed Javascript, all combined into one file using Google Closure.
Now 500 KB of it is only needed for one section of the site.
So I want to combine & compress the Javascript, but separate it into two packages:
Package A - 500 KB - used across the site
Package B - 500 KB - used only in one section of the site
...
How to make teamcity and/or TFS 2010 to run closure compiler for js files in a project.
There are 2 reasons for using closure compiler:
error/warning detection
js minification/obfuscation - optional
...
Is it possible for me to write my own Java Main Class that calls methods in compiler.jar.
I would like to make multiple calls to the compiler and do not want to write code to use Runtime.exec and also do not want to have to wait for Java to load up before every call.
...
I keep getting errors that the function (renamed) does not exist for the given object. Is there a release or setting or something to make it work?
...
Is it possible to provide a multiple source files each with their own destination file in a single command? That way Java won't have to load up for each file I compile. I am using SIMPLE_OPTIMIZATIONS.
I know there are better ways than the one at a time,, but they all seem to require code modifications which I take too much time for the...
In Google Closure Compiler I get the warning
WARNING - dangerous use of the global this object
Here is an example. The error line and offset refers to the beginning of the word this
function aToggle() {
if(shown)
toggle.show()
else
toggle.hide()
$(this).text(shown ? 'Click to hide' : 'Click to show')
shown = !shown...
I love how Google Closure compiler will optimize symbols in code. However, I have not found a good way to define public, exported functions that take configuration objects as parameters. Consider this code snippet:
goog.provide('foo');
goog.require('goog.dom');
/** @typedef {{
* id : string,
* clazz : stri...
I'm seeing this in particular when using the jQuery-1.4.3 externs file. The javadocs for that reads
/**
* @param {(string|number|function(number,number))=} arg1
* @return {(number|jQueryObject)}
* @nosideeffects
*/
jQueryObject.prototype.width = function(arg1) {};
I have a call that looks like this:
var w = $(window).width(...
I'm creating objects with private/public access restrictions as commonly promoted by Crockford. For example, I have something like this:
var foo = (function() {
var myPrivateVariable = "whatever";
return {
myPublicFunction:function(str){
return str;
}
}
}());
If I issue a call, ...