SL Combinator Speed up your website by combining and compressing JavaScript or CSS files on-the-fly.
Compatible with EE 1.
Free download.
Requirements
SL Combinator utilises the splendid open source Minify application, which requires PHP5.
Installation
- Extract the ZIP file.
- Copy
extensions/ext.sl_combinator_ext.phpto yoursystem/extensionsfolder. - Copy
plugins/pi.sl_combinator.phpto yoursystem/pluginsfolder. - Copy
language/english/lang.sl_combinator_ext.phpto yoursystem/language/englishfolder. - Copy the
minfolder to a location of your choosing — for example, autilsfolder in the root of your site. - Ensure that the
min/cachefolder is writeable, by setting its permissions to755. - Open the Extensions Manager, and enable SL Combinator.
Configuration
The SL Combinator extension requires a single setting in order to function correctly; the URL of the min folder that you uploaded during step 5 of the Installation.
To simplify the process of moving your site between development, staging, and live servers, you may find it easier to enter an absolute URL. For example: /utils/min/.
Usage
To combine and compress your JavaScript or CSS files, simply wrap them in the SL Combinator plugin tag. As per the examples below, SL Combinator works best with relative or absolute URLs.
The following code combines and compresses 3 JavaScript files.
{exp:sl_combinator:combine_js disable="no" debug="yes"}
<script type="text/javascript" src="/js/lib/jquery.js"></script>
<script type="text/javascript" src="/js/lib/jquery.easing.js"></script>
<script type="text/javascript" src="/js/custom/contact.js"></script>
{/exp:sl_combinator:combine_js}
And here’s how to do the same for CSS files (note that only the <link> method of importing CSS is supported).
{exp:sl_combinator:combine_css disable="no" debug="no"}
<link rel="stylesheet" type="text/css" media="screen,projection" href="/css/basic.css" />
<link rel="stylesheet" type="text/css" media="screen,projection" href="css/fancy.css" />
<link rel="stylesheet" type="text/css" media="screen,projection" href="../css/schmancy.css" />
{/exp:sl_combinator:combine_css}
SL Combinator won’t allow you to combine CSS files intended for different media. If it suspects that you’re attempting such madness it does the sensible thing, and ignores your request completely.
Parameters
Setting the disable parameter to yes or true disables the plugin. This can be particularly handy during development, as it enables you to temporarily disable the effects of the plugin, without removing all the plugin code from your templates — one simple find-and-replace, and you’re done.
Setting the debug parameter to yes or true causes line numbers to be written to the output file as comments.
License
SL Combinator is made available under a Creative Commons Attribution-Share Alike 3.0 Unported License.