Link | yui_compress |
Author | Jason Huck |
Category | Utility |
Version | 8.5.x |
License | Public Domain |
Posted | 22 Sep 2008 |
Updated | 22 Sep 2008 |
More by this author... |
This tag is a wrapper for the YUI Compressor, a Java package that minifies (optimizes and compresses) JavaScript and CSS files. The tag requires the YUI Compressor, [os_process], and the [shell] tag.
Accepts a source file path, a target file path, and the path to the yuicompressor.jar file as inputs. If no target is specified, the tag returns the output to Lasso instead of writing to disk.
yui_compress( -source='/path/to/big.js', -target='/path/to/small.js', -yuipath='///system/path/to/yuicompressor.jar' );
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag( 'compress', -namespace='yui_', -req='source', -type='string', -opt='target', -type='string', -opt='yuipath', -type='string', -priority='replace', -encodenone, -description='Compresses the specified file using the YUI Compressor.' ); // path to YUI Compressor if(!local_defined('yuipath')); if(var_defined('__amOptions')); local('yuipath') = $__amOptions->find('paths')->find('yui'); else; local('yuipath') = server_webroot + '/lib/tools/yuicompressor.jar'; /if; /if; local('cmd') = 'java -jar ' + #yuipath + ' ' + #source; local_defined('target') ? #cmd += ' -o ' + #target; local('out') = shell('java -jar ' + #yuipath + ' ' + #source); return(#out); /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft