Minifying JS/CSS
From UbikWiki
(Difference between revisions)
m (add category) |
|||
Line 1: |
Line 1: | ||
- | [[Category:Tips and Tricks]] | ||
== Configuration from Project == | == Configuration from Project == | ||
=== Download this Eclipse project [http://www.ubik-ingenierie.com/miscellanous/YUIAnt/ YUIant.zip] (open path then download)=== | === Download this Eclipse project [http://www.ubik-ingenierie.com/miscellanous/YUIAnt/ YUIant.zip] (open path then download)=== | ||
Line 46: |
Line 45: | ||
== History == | == History == | ||
<pageby/> | <pageby/> | ||
+ | [[Category:Tips and Tricks]] | ||
+ | [[Category:Web developpement]] |
Current revision
Contents |
Configuration from Project
Download this Eclipse project YUIant.zip (open path then download)
Set 2 environment variables:
- ANT_HOME
- YUI_COMPRESSOR_HOME (must point to YUICompressor folder)
Run target jar to generate the YUIAnt.jar file in dist folder
Put your JS/CSS files to minify in js folder
Run target minify, minified files will be generated in jsmin
Configuration using YUIAnt.jar
Download the ANT Jar YUIant.jar(open path then download)
Set 1 environment variable:
- YUI_COMPRESSOR_HOME (must point to YUICompressor folder)
Put your JS/CSS files to minify in js folder
Add this ANT target to your build file
You will certainly have to modify the path to js and jsmin folders:
<target name="minify" depends="init" description="Minifiy a set of files"> <available file="${dist.dir}/YUIAnt.jar" property="YUIANT_AVAILABLE" /> <fail unless="YUIANT_AVAILABLE" message="Run jar target to generate the required task"/> <taskdef name="yuicompress" classname="com.yahoo.platform.yui.compressor.YUICompressTask"> <classpath> <pathelement path="${env.YUI_COMPRESSOR_HOME}/build/yuicompressor-2.2.5.jar" /> <pathelement path="${dist.dir}/YUIAnt.jar" /> </classpath> </taskdef> <mkdir dir="${jsmin.dir}" /> <yuicompress linebreak="300" warn="false" munge="yes" preserveallsemicolons="true" outputfolder="${jsmin.dir}"> <fileset dir="${js.dir}" > <include name="**/*.js" /> <include name="**/*.css" /> </fileset> </yuicompress> </target>
Run target minify, minified files will be generated in jsmin
Authors
- Philippe Mouawad
History
- Page created by Pmouawad, 19 November 2007: New page: == Configuration == # Download this Eclipse project [http://www.ubik-ingenierie.com/miscellanous/YUIAnt/Yuiant.zip YUIAnt] # Set 2 environment variables: * ANT_HOME * YUI_COMPRESSOR_HOME (...
- Last modified by Abourre, 27 January 2009: add category