简体   繁体   中英

how to minify JavaScript files using Eclipse JSDT?

如何使用Eclipse JSDT(JavaScript开发工具)“构建” *.min.js*.min.js.map文件?

You can use an external builder to run build scripts for your Javascript tasks.

Go to Project --> Properties and choose Builders. Then you can add an external builder to launch an external program with whatever arguments you need.

为NPM设置外部构建器

You can se the builder to run automatically by using the Build Options tab and setting the "Run The Builder:" options:

在此处输入图片说明

I use YUICompressor . It works on both JavaScript and CSS. Once it's installed, it's easy to use:

  1. Right-click the JS file you'd like to minimize
  2. Go to External Tools > Compress Javascript
  3. Specify the name of the compressed file and click Finish

Unfortunately, you will need to manually run the compressor every time you change the original file, which can get tedious if you're working with lots of files. If you want to automate the process, see this answer . I ended up writing a quick batch script for my project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM