[Catalyst] [ANNOUNCE] New plugin: Catalyst::Plugin::Assets

Bill Moseley moseley at hank.org
Mon Jan 14 14:35:15 GMT 2008


On Sun, Jan 13, 2008 at 09:27:55PM -0800, Robert Krimen wrote:
> Catalyst::Plugin::Assets
> http://search.cpan.org/~rkrimen/Catalyst-Plugin-Assets-0.012/
> 
> Managing .css and .js inclusions has been a recurring problem of mine;
> I usually hack something together with Template Toolkit and call it
> day. Copying and pasting was becoming
> bothersome, though, so I decided to write up a utility to help.

I tend to specify the "assets" in the templates where they are used
instead of in the controller as it's a presentation issue.   I don't
see why your Plugin could not do the same thing by using WRAPPERs.

Is it possible to define "print", "screen", etc. when specifying css?

> C::P::Assets also makes switching between "minified" and development
> versions of .css and .js files really quick and easy (with support for
> YUI compressor, JavaScript::Minifier, CSS::Minifier)

Do you cache this?


Another issue is that in development we might have many individual js
files, but in production would want only a few minified files loaded
from a different location.  The thinking is that we will only have a
few asset files for the entire application (front-loading the assets
on the first request with very long expires).  This is implemented via
the application config which groups js into sections that are combined
in production.

Another approach is use a single js file in the application and in
development have it point to a js file that loads all the other
individual js files, and in production have it load a single minified
version.



-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list