This week, I gave a talk at the Boston JS Meetup. It was a full room
and the majority of the people in it were using jQuery, so I think a
lot of those folks could benefit from plovr -- they just didn't know
I don't expect most jQuery developers to have a lot of interest in the
Closure Library, but both the Compiler and Templates can be a big
help. The way I see it, there are primarily two ways they can use the
* Use the jQuery externs file (thanks Chad Killingsworth!!!) and
compile new JS code against it in Advanced mode (or Simple or
* Don't bother with externs and just compile in Simple mode.
Even for those who are not planning to use the Closure Library with
plovr, I would still force the tool to include base.js for
goog.provide(), goog.require(), and ironically, goog.getCssName(). I
think the first two can potentially help jQuery developers manage
dependencies, and the latter is necessary as we recently changed plovr
so that the JS it generates from Soy uses goog.getCssName(). (It
turned out to be difficult to do this on a per-config basis because
then every call to JsInput.getCode() would have to take a Config,
which would be annoying, and we want this to be default so we can
enable CSS class renaming in the near future.)
Under the above assumptions, jQuery users who use Closure Templates
would end up generating JS that includes the statement
"goog.require('soy')" which would in turn include the 20 transitive
dependencies that soyutils_usegoog.js results in pulling in. For
jQuery users who are compiling in Advanced mode, this should not be an
issue, but I am concerned about those who use Simple mode, as the
unused functions from those 20 dependencies will not be removed by the
Compiler in that case. Arguably, the right thing to do in that case is
to make it possible to include soyutils.js instead of
soyutils_usegoog.js, but there needs to be an elegant way to express
this in the plovr config file.
Currently, it is easy enough to use plovr with jQuery if you know what
(1) Download http://closure-compiler.googlecode.com/svn-history/r678/trunk/contrib/externs/jquery-1.4.4.externs.js
or whatever the appropriate file is for the version of jQuery you're
(2) Add it to the list of "externs" in the plovr config.
(3) Write code!
Although that sounds pretty simple, I'd argue that it isn't simple
enough. It might be easier to have explicit jQuery options in the
In turn, that would include https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
as an input and the appropriate externs file. (Though this external
dependency would not make it possible to develop offline.)
It seems like it should be possible to override where jquery.min.js
comes from so (1) you can develop offline, and (2) you can use your
own version which possibly contains your own edits or the "debugger;"
keyword at key places.
Perhaps you should also be able to choose between
boolean. Maybe the unobfuscated one should actually be the default for
Again, I am not a jQuery developer myself, so I would like to hear
from those who are about what would be the most helpful thing that
could be done to use jQuery with plovr. Examples of new config options
to support this feature would be most illustrative.