Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top