Uglifyjs: Minify multiple files to a directory

Created on 19 May 2016  Â·  18Comments  Â·  Source: mishoo/UglifyJS

Generally there is a way to use a CLI tool to specify several files, and a directory to process the individual files into.

So I presumed uglifyjs src/*.js -o lib/ -c -m would minify each individual file into the lib dir. This doesn't seem to work.

Is it possible to use uglifyjs to minify multiple files into a directory?

question

Most helpful comment

So many people are searching for this - I think it needs to be implemented.

All 18 comments

Uglify will concat the input files. The option -o can only specify the name of an output file.

uglifyjs foo.js bar.js -o out.js

You have to make a script to process the files individually.

How i can concat files with something like main.js *.js, at the moment, main.js appear two times in the output file.

instead of main.js *.js just use *.js

If i want main.js to be the first one in the minified file? How i can manage order for specific files?

then don't use a wildcard and just list all the files out by name in the order you want

You probably already have a solution but I encountered the same problem (issue 1110) so provided candidate solution. However, instead of public/src/js/*.js use public/src/js and all contained JavaScript files will be submitted.

At the moment i stay with the wildcard, i think a solution would be to use the library glob, who allow more complexe wildcards.

So many people are searching for this - I think it needs to be implemented.

So many people are searching for this - I think it needs to be implemented.

This project is a volunteer effort. We await your pull request.

I am not sure how I contribute to the project via a push request. I'm sure it's easy but I just do not have the time to find out. I have a solution in the 3rd follow up comment under issue 1110.

-------- Original message --------
From: kzc [email protected]
Date: 18/07/2016 23:39 (GMT+00:00)
To: mishoo/UglifyJS2 [email protected]
Cc: TGJ Gilmore tracyg.[email protected], Comment [email protected]
Subject: Re: [mishoo/UglifyJS2] Minify multiple files to a directory (#1087)

So many people are searching for this - I think it needs to be implemented.

This project is a volunteer effort. We await your pull request.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

I'm new to this too but it looks fairly easy:

See the numbered list in this article.
http://oss-watch.ac.uk/resources/pullrequest

I have submitted a candidate solution in the form of Pull Request #1240.

Thank you robrecord for the very useful link.

Thank you for the addition, TracyGJG!

Thanks for rolling the ball ;-)

Yep

@backspaces Can you close?

Sure, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jimbly picture Jimbly  Â·  4Comments

alexlamsl picture alexlamsl  Â·  5Comments

alexlamsl picture alexlamsl  Â·  4Comments

JoeUX picture JoeUX  Â·  3Comments

uiteoi picture uiteoi  Â·  5Comments