dead23angel / smarty-combine

Combine and minify many JS or CSS to one file
MIT License
19 stars 9 forks source link

Smarty Combine

Combine plugin allows concatenating several js or css files into one. It can be useful for big projects with a lot of several small CSS and JS files.

Usage examples

Template inline example Smarty 3 or 4.1.0

{combine input=array('/bm.js','/bm2.js') output='/cache/big.js' use_true_path=false age='30' debug=false}

Smarty 2 example

PHP code

$js_filelist = array('/js/core.js','/js/slideviewer.js');

$smarty_object->assign('js_files', $js_filelist);

Template code

{combine input=$js_files output='/cache/big.js' use_true_path=false age='30' debug=false}

The plugin has 4 parameters:

Basedir of css-file is added to relative paths in url()

A semicolon is added at the end of .js-files, as it is not needed at the end of a file, but is needed between concatenated files.