Assetic is an assets content management. For assetic, an asset is an image, a css file or a js file.
In this RFC I'm interested in the js and css management system.
What we want here
What was really useful with this tool is to integrate it with synphony2 and to use assetic capabilities to have a .less merger and compiler, a .css minifier and a .js merger and minifier. Assetic already has interfaces to merge and compile .less and to minify .css written in php. But, currently, does not have a .js merger and minifier written in php.
How is this used?
The objective is to use assetic while compiling the .html files. Instead of only compiling the .html files, compile&minimize its .js and .css files.
Which filters to use?
Thanks to its new additions *high and mighty* yours truly *normal* , JSMin and JSMinPlus are now included as filters of assetic.
I don't know if JSMinPlus has any errors, my tests say no, but I'm not sure (we may use it in the tests and if it fails we may use JSMin). So, to merge js we use assetic's internal merging system. To minimize the code we can use google closure compiler falling back to JSMinPlus or JSMin.
For CSS we have LESSphp and CSSMin to the rescue. We can pass the .less though LESSphp and then pass all the css we have though CSSMin (which also contains an internal prefixer!)
Where should the minified files go?
They can be stored in the cache folder among the .php file that uses it.
The minified file takes space.
Anyway, I think 100KB (exaggerating a bit) is something makes no significant difference in a server, including a free server.
assetic also comes with an interface to use closureCompiler but it requires that the server has allow_url_fopen as true for it to use, so... not an option.
- Ready to use, simple interface.
- Managing the compile of less and css is much more simple.
- Lots of work done and ready for use. Less work for us
- Can much more easy to use if used with INCLUDEJS
- Processing the merge and minification is a slow process *1
- We need to store the compiled files somewhere and that takes space.
I believe there are more pros and there are cons but... I'm not remembering.
The conversation that started all this
Edit: Times have changed (a bit) and this RFC has been slightly changed to makeup for those new times.
Checkout: Which filters to use?