@mattab opened this Issue on February 2nd 2009 Owner

following the YSlow investigation #101, the main improvement we can do to make Piwik UI faster is to use the least number of Javascript and CSS files.

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 all JS files, merge them into one big file, minimize the javascript.
A script would load and merge all CSS files into one CSS.

Implementation idea:

  • rather than including the files directly, developers would use a smarty function to load their content, eg. "include_js_file ( 'UserSettings/js/admin.js' )"
  • this function would know if this JS file is included in the eg. "merged.js" that contains all javascript. If the file contains the JS in 'UserSettings/js/admin.js' then function makes sure the right javascript is returned, otherwise returns call to load the file directly from '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
@anonymous-piwik-user commented on June 21st 2009

Duplicate of #660

This Issue was closed on June 22nd 2009
Powered by GitHub Issue Mirror