[[Dashboard | << Back to Dashboard ]] | << Projects Viewer
{| align="right"
| __TOC__
|}
= JSMin Compressor For ColdBox Applications =
This is a plugin that interfaces with our own flavor of [http://www.crockford.com/javascript/jsmin.html JSMin] to minify css and js files. It can also compress several files of the same type into a single include in order to save even more bandwidth and file space. Of course it is recommended that you only compress into a single file either js or css assets.
== Download ==
You can download the JSMin compressor from ForgeBox: http://www.coldbox.org/index.cfm/forgebox/view/JSMin-Compressor
== Configuration Settings ==
In order for JSMin plugin to work, you must declare the following settings in your ColdBox configuration.
{| cellpadding=?5?, class="tablelisting"
! '''Setting''' !! '''Type''' !! '''Required''' !! '''Default''' !! '''Description'''
|-
|| jsmin_enable || Boolean || false || true || flag to enable disable the packaging process
|-
|| jsmin_cacheLocation || String || true || --- || The relative file location where cached minified js/css files will be stored, this location will be expanded. ex: includes/cache
|}
Here is an example of the settings:
minify(assets:string) : html script or link tagsThe main method of operation is ''minify()''. You pass to it a list of assets to compress, but they have to be of the same type: js or css. Do not alternate or weird results will happen. This method returns a script or link include that you would output on your layouts, let's see an example:
minifyToHead(assets:string) : voidThis method basically sends the html links and script tags to the head section using ''cfhtmlhead''. You can use this method when calling JSMin via handlers or plugins or any other location than layouts. So now go out and have fun minifiying with ColdBox!