Hi David,

Indeed, it is a very good idea and I think it can be very useful for others.

The best way to contribute this work is to package the code in a plugin.

The plugin can contains the pake task (compress-css) and your filter.

Fabien

David Brewer wrote:
> I have an idea for a css compression feature that I would like to see
> added to Symfony.  It's possibly that there are already plans for
> something like for Symfony afoot of which I am not aware... please let
> me know if I didn't look in the right place to spot it.  If not, I've
> already implemented some code which might be used as a basis for this
> feature.
> 
> The company I work for is using Symfony as a base for a relatively
> complex web application for a museum.  The system of stylesheets we
> have developed is relatively complicated.
> 
> The main stylesheet (main.css) actually contains nothing but a series
> of @import statements to bring in 9 secondary stylesheets, which are
> named by their contents (form.css, text.css, layout.css, and so on).
> We did this to avoid having one monster stylesheet that it is
> impossible to find anything in.
> 
> The problem with this, of course, is that the first time you hit the
> site you have to wait for the main.css to be loaded and parsed, and
> then for the 9 separate stylesheets to get loaded.  For the production
> site it's better to have as many of your styles as possible in one
> file to avoid multiple http requests.
> 
> For our project I created a system to deal with this:
> 
> * The 'source' or original stylesheets are kept in web/css/src.
> * When you look at the site in the development environment, all the
> paths to stylesheets are automatically changed to point to css/src so
> you can see your changes immediately.  I accomplished this by means of
> a filter, but if it was a core feature it could be better integrated.
> * I created a pake task for generating the production css files.
> Running 'symfony compress-css' looks in 'css/src' and outputs
> compressed versions of those files to the 'css' folder.  Not only
> that, but it parses each css file for import statements and replaces
> them with the contents of the file that was imported before doing
> that.
> * I used a naming convention to allow the pake task to skip processing
> any of the css files which are only used as an import into a parent
> file.  For instance, if main.css imports several files, those files
> might be named main_layout.css, main_form.css, and so on.
> 
> That's about it.  I'm not convinced that the naming conventions I set
> up are perfect, but I think it is a valuable feature.  I also think
> that the same idea could be extended to allow for the automatic
> shrinking and combination of javascript files with similar benefits.
> 
> Is there any interest in this feature?  And if so, what is the best
> path for contributing code?
> 
> David Brewer
> Programmer
> Second Story Interfactive
> 
> > 
> 
> 

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to