This is a plugin that interfaces with our own flavor of JSMin to minify
have also added LESS support for compiling LESS into CSS for you or on-demand.
jsmin_enable : boolean (defaults to true)
- flag to enable disable the packaging process
jsmin_cacheLocation : string
- the relative file location where cached minified js/css files will be stored,
this location will be expanded. ex: includes/cache
If any of the minify methods cannot find a location argument or the jsmin_cacheLocation setting
then an exception will be thrown.
* minify(assets:string, location:relativePath) : html script or link
The 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/less. Do not alternate or weird results will
happen. This method returns a script or link include that you would output on your layouts:
// With Location
As you can see from the example above, you can easily render the minified version of all
the assets. This plugin will minify each asset and if more than 1 is declared, then it
will build a concatenated version of the js or css/less assets and cache them. If the files
are of LESS extension, then the plugin will compile the LESS into CSS files.
You can use the alternate 'location' argument to choose the location of the compressed and
* minifyToHead(assets:string, location:relativePath) : void
This 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.
* compileLessSource(input:LESS, [ output:absolutePath ]) : CSS
This method compiles LESS source into CSS for you and returns it to you if no output argument is used,
else the compiled source is sent to the output file. An extra goody about this method is that
compilation only takes place if the source LESS file has been modified.
* compileLess(input:absolutePath, [ output:absolutePath ]) : [void | CSS]
This methods can compile an input LESS file into an output CSS file or you can omit passing
the output file argument and the method will return to you the compiled CSS.
Install in your custom plugins folder or coldbox extensions. Make sure the lib folder is alongside the JSMin plugin.
# Updated the internal Java Less compiler to allow for relative import paths
# Fixed locking issues when generating cached files under high load
# Fixes for responsive design
# Added capabilities for LESS compilation
# Auto-detection of LESS files in minify
# ColdFusion 9 and above only
# Update of java libraries
# Fixes for media queries via CF as it was easier than in the java parser
# fixes to css selectors when using bracket notations
# OOps file name fixes
# Added ability to store files without using a UUID so they can survive fwreinits and load balancing
thanks to Scott ColdWell
# Updated to use StringBuilder instead of Buffer.
# Fixing of empty first line
# Updates to core java processor to add more funky css definitions via commenting system in css and js.
# Updates to core java processor to add more funky css definitions
# Fixes to trimming incoming assets
# Updates to core java processor to distinguish between css and js compression
# Fixed negative margin issues with css compression
# Fixed advanced spaced selectors with css compression
# Initial Release
Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.
||Dec 23 2009 07:25 AM
||Jun 10 2016 02:26 AM