Hi!
How do you solve the cache invalidation for these resources (in case
they are cached on the client side)?
Please post also a link to the sources.
Thanks,
gabriel
On Aug 14, 5:08 pm, Tom Boutell <[email protected]> wrote:
> We've committed a new CSS and JS minifier to the trunk of
> apostrophePlugin. It's possible to take advantage of this even if you
> don't need the rest of Apostrophe for your project.
>
> Apostrophe now has a built-in CSS and JS minifier, similar to
> sfCombinePlugin but up to date and easier to work with. All you have
> to do is call a_include_javascripts and a_include_stylesheets in your
> layout.php rather than the usual include_javascripts and
> include_stylesheets.
>
> Although we didn't start from sfCombinePlugin, which has not been
> updated for about a year, we are not reinventing the wheel here.
> Apostrophe now bundles the latest stable release of the excellent
> Minify package by Ryan Grove and Steve Clay.
>
> We're not using Minify's built-in server. Instead we are using the
> Minify library classes to do the actual minification and integrating
> these into our helpers for a native Symfony feel. That means that:
>
> * When minification is turned on with app_a_minify, all CSS files
> needed on a page are rolled into a single file
> * Ditto for JavaScript
> * The cache files are automatically reused if they already exist
> * The cache files are automatically erased when you 'symfony cc' on a
> particular server, as you ought to do when you deploy anyway
> * Files that need to be loaded separately (for instance, they have IE
> conditional comments) are still loaded the traditional way
> * Files that need to load together as a group because they have the
> same script tag options (for instance, print stylesheets) are merged
> to a separate cache file from the rest
> * When app_a_minify_gzip is turned on, minimized CSS and JS files are
> automatically gzip-compressed in advance when they are generated (the
> necessary .htaccess directives to allow your server to support this
> are in the trunk sandbox .htaccess file, take a look - all web
> browsers support this so it's a big win)
>
> Dead simple and very effective.
>
> With app_a_minify and app_a_minify_gzip both turned on, the logged-out
> view of the Apostrophe sandbox now receives a "B" grade from the YSlow
> plugin. Those who are familiar with YSlow know that a "B" is extremely
> hard to get. YSlow dings you for every little infraction, including
> the use of images that are not CSS sprites and so on. Our former score
> was an "D"
> on an "A" to "F" scale (a "C" if the server is configured to gzip
> everything on the fly, but that takes more CPU than app_a_minify_gzip,
> which runs only at caching time).
>
> To use this in a project in which you don't otherwise want Apostrophe
> (although I obviously think you should consider using it!), you'll
> want to tell Apostrophe to disable its built in routes:
>
> app_aMedia_routes_register: false
> app_a_routes_register: false
>
> Turn it on in app.yml (for testing, do it under 'all', but later
> probably just 'prod' so you can still easily debug JS and CSS):
>
> all:
> a:
> minify: true
> #Optional but a huge win, requires appropriate Apache
> configuration and zip support in PHP
> minify_gzip: true
>
> And just start calling a_include_javascripts and a_include_stylesheets
> instead of include_javascripts and include_stylesheets in your
> layout.php.
>
> To make the gzipped CSS and JS files work, your PHP must have zlib
> support (check your phpinfo), and Apache must be configured to serve
> .cssgz and .jsgz files correctly (you can do this in your .htaccess
> file):
>
> AddType text/javascript .jsgz
> AddType text/css .cssgz
> AddEncoding x-gzip .jsgz .cssgz
>
> If you don't want to do that, you can leave app_a_minify_gzip turned
> off, but it won't be as awesome.
>
> symfony cc and go to town.
>
> That's it - no database tables needed, no schema changes.
> Note that web/uploads/asset-cache needs to be writable by Apache
> (project:permissions should take care of this).
>
> Enjoy!
>
> --
> Tom Boutell
> P'unk Avenue
> 215 755 1330
> punkave.com
> window.punkave.com
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en