日期:2014-05-16 浏览次数:20340 次
REM ===================================== REM YUI Compressor CMD Script REM REM - by yubo@taobao.com REM - 2009-02-12 REM =====================================
UglifyJS 安装指南 ========= 安装步骤: 0. 安装nodejs运行环境:http://nodejs.org/,设置nodejs的安装目录到PATH中,一句话CMD中输入 node --version: --->C:\Users\xin>node --version --->v0.6.15 1. 安装请点击 install.cmd 2. 卸载请点击 uninstall.cmd 3. 如果安装过之前的版本,请先卸载老版本 压缩测试: 选中 test.js, 执行右键菜单“Process with UglifyJS”,会生成 test-min.js.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.5</version> <executions> <execution> <id>copy-config</id> <goals> <goal>copy-resources</goal> </goals> <phase>compile</phase> <configuration> <outputDirectory>${project.build.directory}</outputDirectory> <resources> <resource> <directory>src/test/resources</directory> <includes> <include>uglify/*</include> <include>uglify/lib/*</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <phase>install</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <echo message="开始用uglifyjs压缩 JSP 文件. 请耐心等待!" /> <property name="uglifyjs" value="${project.build.directory}/uglify/uglifyjs" /> <property name="jsp.compress.directory" value="${project.build.directory}/${project.build.finalName}/WEB-INF" /> <apply executable="node" parallel="false" failonerror="true" dest="${jsp.compress.directory}"> <fileset dir="${jsp.compress.directory}" includes="**/*.jsp" /> <arg line=" ${uglifyjs}" /> <arg line=" --ascii" /> <arg line=" -o" /> <targetfile /> <srcfile /> <mapper type="regexp" from="^(.*)\.(jsp)$" to="\1-min.\2" /> </apply> <move todir="${jsp.compress.directory}"> <fileset dir="${jsp.compress.directory}" includes="**/*.jsp" /> <mapper type="regexp" from="^(.*)-min\.(jsp)$" to="\1.\2" /> </move> <echo message="成功用uglifyjs压缩 JSP 文件" /> <echo message="开始用uglifyjs压缩 JS 文件. 请耐心等待!" /> <property name="uglifyjs" value="${project.build.directory}/uglify/uglif