How to use UglifyJS from Ant build?

I want to embed UglifyJS in my Ant build process to replace the YUI Compressor. What are the basic steps to get started?

+6
source share
2 answers

After installing uglifyjs with the -g option:

npm install uglify-js -g 

Use ant as follows:

 <exec dir="${build_dir}" executable="uglifyjs.cmd"> <arg line="-o jquery.min.js --unsafe -nc jquery.src.js"/> </exec> 

On Windows, you use uglifyjs.cmd and uglifyjs on linux. You can define a conditional property if you want to preserve the cross platform build.xml.

See https://github.com/mishoo/UglifyJS/#usage for all arguments

+7
source
+1
source

Source: https://habr.com/ru/post/890689/


All Articles