List Info

Thread: Re: Auto JavaScript files minification




Re: Auto JavaScript files minification
country flaguser name
Germany
2008-01-02 11:28:05

----- "Ian Bicking" <ianbcolorstudy.com> wrote:
> Pedro Algarvio, aka, s0undt3ch wrote:


> I've used ShrinkSafe on YUI and it worked fine.  I'm
surprised it
> didn't 
> work on jquery, it's supposed to be a pretty safe
shrinker.
> 
> A flag you could put in setup.cfg to choose the
shrinker to use would
> be 
> ideal.  Last I looked Yahoo didn't seem to have a
service that did 
> shrinking, and the installation was non-trivial.  The
ease of using 
> ShrinkSafe was really its biggest selling point for
me.
> 
> Note that the helper also combines Javascript files,
which perhaps
> more 
> important than shrinking the files.

Combine JS's into a single file, but then which one would
you call?
Always the compressed one?

I've now tried the Yahoo's compressor:
46195 2008-01-02 17:18 jquery-latest.min.js

Size is always greater that those generated by ShrinkSafe.

By the idea of ShrinkSafe, perhaps also add the minified
keyword to stylesheet_link_tag.

I'll see if I gather a patch for the webhelpers. By the way,
where are patches submited now, still PylonsHQ?
-- 
Pedro Algarvio
   __ ___  ___ _______        ___ __
|   Y   .'  _|   _   .-----.'  _|  |_   .-----.----.-----.
|.  |   |   _|   1___|  _  |   _|   _|__|  _  |   _|  _  |
|.  |   |__| |____   |_____|__| |____|__|_____|__| |___  |
|:  1   |    |:  1   |                             |_____|
|::.. . |    |::.. . |  ufs [AT] ufsoft [DOT] org
`-------'    `-------'    ufs [AT] sapo [DOT] pt

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Auto JavaScript files minification
country flaguser name
United States
2008-01-02 11:44:51
Pedro Algarvio, aka, s0undt3ch wrote:
> 
> ----- "Ian Bicking" <ianbcolorstudy.com> wrote:
>> Pedro Algarvio, aka, s0undt3ch wrote:
> 
> 
>> I've used ShrinkSafe on YUI and it worked fine. 
I'm surprised it
>> didn't 
>> work on jquery, it's supposed to be a pretty safe
shrinker.
>>
>> A flag you could put in setup.cfg to choose the
shrinker to use would
>> be 
>> ideal.  Last I looked Yahoo didn't seem to have a
service that did 
>> shrinking, and the installation was non-trivial. 
The ease of using 
>> ShrinkSafe was really its biggest selling point for
me.
>>
>> Note that the helper also combines Javascript
files, which perhaps
>> more 
>> important than shrinking the files.
> 
> Combine JS's into a single file, but then which one
would you call?
> Always the compressed one?

Well, if you have just one working set of JS (which probably
is fine, as 
the improved caching from that is probably worth loading a
little JS 
that you might not need for a particular page), then yes,
you'd call the 
compressed/combined JS file in production (but maybe not in
development).

I guess it doesn't quite fit with the current web helper
functions, as 
they are one-call-per-file, and you may have one or many
files depending 
on whether you are using the combined files.

> I've now tried the Yahoo's compressor:
> 46195 2008-01-02 17:18 jquery-latest.min.js
> 
> Size is always greater that those generated by
ShrinkSafe.
> 
> By the idea of ShrinkSafe, perhaps also add the
minified keyword to stylesheet_link_tag.
> 
> I'll see if I gather a patch for the webhelpers. By the
way, where are patches submited now, still PylonsHQ?

Yep.

-- 
Ian Bicking : ianbcolorstudy.com : http://blog.ianbicking.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Auto JavaScript files minification
user name
2008-01-02 12:18:59
Here are some links on reducing the number of requests to
improve performance.

http://yuiblog.com/blog/2006/11/28/performance-re
search-part-1/

http://developer.yahoo.net/blog/archives/20
07/04/rule_1_make_few.html

http
://developer.mozilla.org/en/docs/Tips_for_Authoring_Fast-loa
ding_HTML_Pages#Minimize_the_number_of_files

To highlight another view on JS optimization, I just
finished a
project for which I used the Dojo toolkit's build
infrastructure.  It
is certainly Dojo centric though it will work non-Dojo
Javascript.

http://dojotoolkit.or
g/book/dojo-book-0-9/part-4-meta-dojo/package-system-and-cus
tom-builds

It has a concept of layers so you can push common javascript
into a
single compressed file with page specific parts compressed
into
separate files.  For JS using the Dojo package system it
will only
pull in packages that are actually used.  So if you
implement a widget
for your site that only uses Dojo's Dialog widget you will
only have
Dialog and it's dependencies in your newly combined and
compressed JS
file.

Their build uses ShrinkSafe, a patched copy of the Mozilla
Rhino jar,
and their own JS glue code.  Despite the complexity it was
simple to
use, however on the whole I would say it fails the
easy-to-install
test pretty badly and really only makes sense for sites
using Dojo.

On Jan 2, 2008 12:44 PM, Ian Bicking <ianbcolorstudy.com> wrote:
>
> Pedro Algarvio, aka, s0undt3ch wrote:
> >
> > ----- "Ian Bicking" <ianbcolorstudy.com> wrote:
> >> Pedro Algarvio, aka, s0undt3ch wrote:
> >
> >
> >> I've used ShrinkSafe on YUI and it worked
fine.  I'm surprised it
> >> didn't
> >> work on jquery, it's supposed to be a pretty
safe shrinker.
> >>
> >> A flag you could put in setup.cfg to choose
the shrinker to use would
> >> be
> >> ideal.  Last I looked Yahoo didn't seem to
have a service that did
> >> shrinking, and the installation was
non-trivial.  The ease of using
> >> ShrinkSafe was really its biggest selling
point for me.
> >>
> >> Note that the helper also combines Javascript
files, which perhaps
> >> more
> >> important than shrinking the files.
> >
> > Combine JS's into a single file, but then which
one would you call?
> > Always the compressed one?
>
> Well, if you have just one working set of JS (which
probably is fine, as
> the improved caching from that is probably worth
loading a little JS
> that you might not need for a particular page), then
yes, you'd call the
> compressed/combined JS file in production (but maybe
not in development).
>
> I guess it doesn't quite fit with the current web
helper functions, as
> they are one-call-per-file, and you may have one or
many files depending
> on whether you are using the combined files.
>
> > I've now tried the Yahoo's compressor:
> > 46195 2008-01-02 17:18 jquery-latest.min.js
> >
> > Size is always greater that those generated by
ShrinkSafe.
> >
> > By the idea of ShrinkSafe, perhaps also add the
minified keyword to stylesheet_link_tag.
> >
> > I'll see if I gather a patch for the webhelpers.
By the way, where are patches submited now, still PylonsHQ?
>
> Yep.
>
> --
> Ian Bicking : ianbcolorstudy.com : http://blog.ianbicking.org

>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Auto JavaScript files minification
country flaguser name
United States
2008-01-02 12:58:36
Thomas E Jenkins wrote:
> Here are some links on reducing the number of requests
to improve performance.
> 
> http://yuiblog.com/blog/2006/11/28/performance-re
search-part-1/
> 
> http://developer.yahoo.net/blog/archives/20
07/04/rule_1_make_few.html
> 
> http
://developer.mozilla.org/en/docs/Tips_for_Authoring_Fast-loa
ding_HTML_Pages#Minimize_the_number_of_files
> 
> To highlight another view on JS optimization, I just
finished a
> project for which I used the Dojo toolkit's build
infrastructure.  It
> is certainly Dojo centric though it will work non-Dojo
Javascript.
> 
> http://dojotoolkit.or
g/book/dojo-book-0-9/part-4-meta-dojo/package-system-and-cus
tom-builds
> 
> It has a concept of layers so you can push common
javascript into a
> single compressed file with page specific parts
compressed into
> separate files.  For JS using the Dojo package system
it will only
> pull in packages that are actually used.  So if you
implement a widget
> for your site that only uses Dojo's Dialog widget you
will only have
> Dialog and it's dependencies in your newly combined and
compressed JS
> file.

Zope has some fancy stuff for combining resources
transparently, and it 
has generally bugged the hell out of me.  Probably Dojo is
less 
transparent, and more sensible as a result.

> Their build uses ShrinkSafe, a patched copy of the
Mozilla Rhino jar,
> and their own JS glue code.  Despite the complexity it
was simple to
> use, however on the whole I would say it fails the
easy-to-install
> test pretty badly and really only makes sense for sites
using Dojo.

Except for shrinking, it all is pretty simple stuff -- find
the files, 
concatenate them, run the shrinker.  The WebHelper distutils
extension 
is okay, but could be better, e.g., make it easier to define
what files 
are compressed where, and easier for that to be confirmed by
the <link> 
generating code.

Part of the problem is fitting the configuration in
setup.cfg.  Maybe it 
should be a separate config file referred to by setup.cfg,
like:

   [main.js]
   combine = file1.js file2.js file3.js
   shrink = true
   # shinker = yui, jsmin, shrinksafe, etc

   [main.css]
   combine = file1.css file2.css

   [extra.js]
   combine = file4.js file5.js
   shrink = true


Then have the combiner write out something that indicates
what files 
were combined to where, and have something like:

   link_javascripts(['file1.js', 'file3.js'])

And it would produce as many <link> tags as necessary
to make sure all 
those files are available (and also use some debug flag).


-- 
Ian Bicking : ianbcolorstudy.com : http://blog.ianbicking.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )