Combine plugin allows concatenating several js or css files into one. It can be useful for big projects with a lot of several small files.
Why should I use it
First issue - you don't have modularity. For example, you have heavy page with tons CSS files or JS files. Each CSS file concerns to relevant block on the page. Much easier to edit one small CSS file than one big and long file. But you have a lot of queries to the server. This plugin allows to combine several files to one and resolve this issue.
Second issue related to browser and proxy caching. When you edit your files, they have the same name and therefore they could adhere in browsers or proxies cache very long. Sometimes developers add something after question sign. It looks like style.css?ver=12.This method is ugly, but works. Sometimes is not. In my experience I saw proxy with extreme cache configuration policies - they have ignored headers from the server and do not allow updating CSS and JS files with the same name during a month or week. My plugin resolves these problems. It will give unique name for output file when at least one of files from the bundle will be upgraded. It can help you to bring actual interface and functionality to your users.
Template inline example Smarty 3
Smarty 2 example
$js_filelist = array('/js/core.js','/js/slideviewer.js'); $smarty_object->assign('js_files', $js_filelist);
Plugin have 3 parametrs:
- input - must be an array, containing list with absolute pathes to files. In Smarty 3 it can be inline array, for Smarty 2 you will need to pass from yours controller a variable, which will contains this array.
- output - absolute path to output file. Directory must be writable to www daemon (Usually chmod 777 resolve this problem :)
- age - value of seconds between checks when original files were changed. By default it is 3600 - one hour. You can omit this parameter.
git clone https://github.com/zoonman/smarty-plugins.git
It was tested on site with 40000 pageviews per day and works perfectly.