svn commit: r1310983 - in /ofbiz/trunk: build.xml framework/base/lib/yuicompressor-2.4.6.jar macros.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1310983 - in /ofbiz/trunk: build.xml framework/base/lib/yuicompressor-2.4.6.jar macros.xml

jleroux@apache.org
Author: jleroux
Date: Sun Apr  8 12:12:07 2012
New Revision: 1310983

URL: http://svn.apache.org/viewvc?rev=1310983&view=rev
Log:
Creates an ant task which uses YUICompressor (yuicompressor-2.4.6.jar) to dynamically minify our own (or custom for users) js and css files (most of the biggest external ones are already compressed)
More work is needed, this is just the the minimum with an example.

Related to https://issues.apache.org/jira/browse/OFBIZ-4792

Added:
    ofbiz/trunk/framework/base/lib/yuicompressor-2.4.6.jar   (with props)
Modified:
    ofbiz/trunk/build.xml
    ofbiz/trunk/macros.xml

Modified: ofbiz/trunk/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=1310983&r1=1310982&r2=1310983&view=diff
==============================================================================
--- ofbiz/trunk/build.xml (original)
+++ ofbiz/trunk/build.xml Sun Apr  8 12:12:07 2012
@@ -1225,6 +1225,15 @@ under the License.
     </target>
 
     <!-- ================================================================== -->
+    <!-- Minify js and css files target.                                    -->
+    <!-- ================================================================== -->
+
+    <target name="minifyJsCss" description="Creates a minified version of JS/CSS files">
+        <!-- Needs more work (more files, use of them) just used as an example -->
+        <!--yuicompressor inFile="themes/tomahawk/webapp/tomahawk/css/style.css" outFile="themes/tomahawk/webapp/tomahawk/css/style-min.css"/-->
+    </target>
+
+    <!-- ================================================================== -->
     <!-- Old tasks.                                                         -->
     <!-- ================================================================== -->
     <target name="run">

Added: ofbiz/trunk/framework/base/lib/yuicompressor-2.4.6.jar
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/yuicompressor-2.4.6.jar?rev=1310983&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ofbiz/trunk/framework/base/lib/yuicompressor-2.4.6.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: ofbiz/trunk/macros.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=1310983&r1=1310982&r2=1310983&view=diff
==============================================================================
--- ofbiz/trunk/macros.xml (original)
+++ ofbiz/trunk/macros.xml Sun Apr  8 12:12:07 2012
@@ -260,4 +260,18 @@ under the License.
    </if>
   </sequential>
  </macrodef>
+
+ <macrodef name="yuicompressor" description="Runs the YUI JS/CSS compressor on the specified inFile and saves the output to outFile">
+  <attribute name="inFile"/>
+  <attribute name="outFile"/>
+  <sequential>
+    <echo message="Minify @{inFile}"/>
+      <java jar="${ofbiz.home.dir}/framework/base/lib/yuicompressor-2.4.6.jar" fork="true">
+        <arg value="-o"/>
+        <arg value="@{outFile}"/>
+        <arg value="@{inFile}"/>
+    </java>
+   </sequential>
+ </macrodef>
+
 </project>