문제

Rather than adding code and files to the uglify script individually, is there any way to tell uglify to grab an entire dir, and output into 1 script.js file?

도움이 되었습니까?

해결책

cat * | uglifyjs -o script.js

If by uglifyjs you mean https://github.com/mishoo/UglifyJS this works! Without an input file uglifyjs will read from STDIN.

다른 팁

find /path/to/dir -name "*.js" | xargs cat | uglifyjs -o > result.js

Note that the load order of your scripts might be important. The above could therefore fail (as it just dumps the files in whatever order find happens to return them). I would suggest you to write a small shell script customized for your application.

https://github.com/balupton/buildr.npm may also be helpful

The (Java|Coffee)Script and (CSS|Less) (Builder|Bundler|Packer|Minifier|Merger|Checker)

You can use uglifyjs-folder module for that. It also supports processing them individually (no merging together).

https://github.com/ionutvmi/uglifyjs-folder
https://www.npmjs.com/package/uglifyjs-folder

I'm late to the party, but I found Igneous to be very convenient. It does what it says without imposing additional constraints or philosphies.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top