On Tue, 2013-10-29 at 22:58 -0700, Sarvi Shanmugham wrote:
>
>
>
> Is there a reason for distributing multiple script segments inside a
> single html file?
I think there is/was. Maybe it was just because of opera. It couldn't
handle large script elements.
> Can they be one big compiled script segment with all the code?
Probably yes. But most people (with large apps) use dynamic loading, so
they don't have a single large file. With separate script segments in
the monolithic html this resembles (a bit) the dynamic load use case.
Obviously, with dynamic load you can't compile them all together.
However, you might parse the html file (with some regex) and put all
script elements into one script element.
>
> Has anyone used closure compiler ADVANCED_OPTIMIZATIONS and got things
> to work?
I'm not sure, but if I did, that would be a looong time ago. I didn't
want to find out all the possible externs/expose. I think that that's
why I changed all foo.bar to foo['bar'] in the js code.