[Catalyst] Minify JS/CSS and server as static files

Pavel Karoukin hippich at gmail.com
Thu Aug 11 15:41:55 GMT 2011


On 08/08/2011 12:05 AM, Bill Moseley wrote:
> What I do is define a YAML file that defines "resource sets" (where a
> "resource" is anything I want to serve differently in production, like
> css, javascript and even versioned items like background images or PDFs).
>
> For example, a set might be defined of one or more (typically more)
> css files.  The set has a name (e.g. "style") and then in my templates
> I use a macro to include it.  Under development the markup is rendered
> with the individual css files that make up the set.  Under production
> the markup includes a link to a single minified and versioned
> versioned URL (on a CDN).   We can also easily toggle this on
> production via request data (to debug on production someone wanted).
>  The versioning is done via an md5 of the compressed file and the
> minified files are cached forever.
>
> The build process runs a script that builds the minified files.  I've
> often though about trying to integrate it into the Makefile so that
> only changed source files trigger a build of the minified file.
>
>

Thank you Bill. This looks like a good approach.

Could you tell me more about your YAML config, is it part of
"MyApp.yaml" or it is separate? If it is separate - how do you plug it in?

Also, could you tell me more about versioning you use? Do you generate
different filenames for each compressed file or you do something else?

Regards,
Pavel



More information about the Catalyst mailing list