I'd be really curious to know how closure script achieves any
speed-ups in this area over plovr. Generally when using plovr, I use
RAW mode, which causes the files to get loaded in as-is, which makes
for an instaneous edit-refresh-test cycle, but loses the advantages of
compiler analysis in that cycle.
I develop the code in regular mode (i.e. no query string on the URL).
In this case the CSS file should be compiled with *--output-renaming-
map-format CLOSURE_UNCOMPILED* so that the map is not enclosed in
goog.setCssNameMapping and thus putting in as --js parameter does not
gives error: that is - in un-compiled mode the mapping is exported as
global variable and it is found this way by the rest of the library
This is all fine, I go and as some case statement in the
compiler.js.erb file and I can have the appropriate options depending
on the query string.
However something funny happens when the css_renaming_map.js has been
once profuced in compiled mode - it is no longer overwritten. What I
believe is happening your code (compiler-stylesheet.rb) tries to avoid
extra work and does not recompile the mapping as the source has not
changed. Can this be considered when adding this part to the closure
script? I mean - as per your advise we always include the same map
file and we always do it before other files, so it is the first to be
loaded in regular mode and goog then is not defined.
Thanks for the work, with this small exception the rest is working
great.
On Dec 6, 7:35 am, Robert Stuttaford <robert.stuttaf...@gmail.com>
wrote:
> Here you go.
>
> Drop the attached *closure-stylesheets.rb* into a folder, 'lib', and put
> the *closure-stylesheets-20111202.jar* there too (just name it *
> closure-stylesheets.jar*).
>
> Then, in *config.ru*, after *require 'closure'* but before anything else:
>
> $LOAD_PATH << './lib'
> require 'closure-stylesheets'
>
> And in *compiler.erb.js*:
>
> goog.gss_to_css %w{
> --rename CLOSURE
> --output-renaming-map css_renaming_map.js
> --output-renaming-map-format CLOSURE_COMPILED
> --output-file styles.css
> **/*.gss
>
> }
>
> Also in *compiler.erb.js*, before your call to *--ns app.App*:
>
> --js css_renaming_map.js
>
> This probably won't all work immediately, you'll have to fuss with pathing
> until you get it right.
>
> I had to inspect my project's folder to see where css_renaming_map actually
> appeared and update the main compiler call to reference it there.
>
> @David Turnbull: feel free to put this directly into Closure Script after
> reviewing it, if you like! It's basically a direct copy of Templates with
> all the relevant bits switched over for GSS.
>
> closure-stylesheets.rb
> 3KViewDownload