[opencms-dev] Auto-Condense Javascript and CSS code - new opencms tag cms:minify
Christian Steinert
christian_steinert at web.de
Sat Feb 14 13:38:02 CET 2009
Dear all,
inspired by the jQuery support in OpenCms, I have implemented a new tag
for the opencms taglib, called cms:minify.
The tag can automatically condense JavaScript and CSS code. The tag is
used by enclosing a block of CSS of JavaScript with it, for example:
<cms:minify type="js">
function myFunc() {
myVar = 123;
alert( myVar );
}
</cms:jsminify>
The result in this case would be: "function myFunc(){a=123;alert(a)}"
The tag implementation together with instructions is available from:
http://www.berzinarchives.com/temp/opencms/cms-minify.1.0.zip
*@ALKACON*: I would very much like to see this code being added to the
regular opencms distribution. The implementation is one single Java
class the size and structure of which is very much comparable to other
classes in the opencms taglib. The code is documented and written to
work with Java 1.4. It's licensed under LGPL. The code uses the
excellent YUI compressor (BSD license) which has also been adopted by
the jQuery team. If you could rename the class and add it to a future
version of opencms, I then think this could give a boost to JavaScript
development with OpenCms.
The tag is capable of detecting if it is in an offline project. In this
case, no compression will be done so that developers can still see their
code in full beauty at development time.
I would appreciate feedback.
Best Regards
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090214/df9c9d05/attachment.htm>
More information about the opencms-dev
mailing list