How to "build" *.min.js
and *.min.js.map
files using Eclipse JSDT (JavaScript Developement Tools)?
Asked
Active
Viewed 4,599 times
0

user2449761
- 1,169
- 13
- 25
-
http://jscompress.com/ – Abdul Jabbar Sep 30 '14 at 12:08
-
can't I do it with Eclipse? – user2449761 Sep 30 '14 at 12:16
-
https://github.com/oncereply/jscompressor – Abdul Jabbar Sep 30 '14 at 12:18
-
jscompressor doesn't generate map files ;/ It is also not very comfortable tool – user2449761 Sep 30 '14 at 12:32
2 Answers
2
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.
You can se the builder to run automatically by using the Build Options tab and setting the "Run The Builder:" options:

BCG
- 1,170
- 8
- 19
-
-
The process is the same. However instead of have a path like /usr/bin/npm though you would just use a path like C:\tools\sometool.exe ... the 'browserify' part is not really relevant to the process BTW, you can set up any external command you want for the builder. – BCG Sep 30 '14 at 12:42
-
-
You can set up a builder for whatever external you would normally use for processing your JS files... if you have something like a grunt file you could just call that, or you could use some external tool directly like http://lisperator.net/uglifyjs/ – BCG Sep 30 '14 at 13:28
-
sorry I am new to JavaScript ;/ How to use this lisperator.net/uglifyjs ? – user2449761 Sep 30 '14 at 13:37
1
I use YUICompressor. It works on both JavaScript and CSS. Once it's installed, it's easy to use:
- Right-click the JS file you'd like to minimize
- Go to External Tools > Compress Javascript
- 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.