Piwik is sometimes using 10 CSS and 5 to 10 JS files, that is a lot of http requests to get all these files.
A system that would merge all files, could be implemented in an ANT task for example.
It would have to work well with Plugins as all the UI code is splitted across plugins.
A script would load and merge all CSS files into one CSS.
- rather than including the files directly, developers would use a smarty function to load their content, eg. "include_js_file ( 'UserSettings/js/admin.js' )"
- a script to compile JS and CSS would have to run and learn the list of files to include in which compressed file. It could read this from a static directory scheme (plugins/PLUGIN_NAME/js/* contains all JS files, etc.) or be read from grepping the .tpl files looking for meta definition of function calls?
- versioning files (js_045099.js) would be considered but optional especially if it makes implementation/setup harder
- we should use existing librairies that read, compress JS and CSS files. This tasks includes researching the best tool to use to do this
- how we ensure this is run at every piwik build? piwik is using Hudson for continous integration, this could for exammple be done in an ant script