Brandon
Brandon

Reputation: 10953

YUI Compressor - Automate Javascript Compression but skip some files

I am following the suggested answer on this SO post:

How to automate JavaScript files compression with YUI Compressor?

However, in my ~/Scripts folder, I have several jQuery files that are already compressed and minified. What do I need to do to automate it in a similar fashion but skip the jQuery files?

Upvotes: 1

Views: 703

Answers (2)

mre666
mre666

Reputation: 336

maybe something like this:

cd ~/Scripts
find . -name "*jquery*" -prune -o -type d -o -exec java -jar yuicompressor.jar -o '.js$:-min.js' {} +

Upvotes: 0

sdleihssirhc
sdleihssirhc

Reputation: 42496

You could name all of your uncompressed files whatever.max.js, and then change the rule to something like this:

for %%a in (*.max.js) do @java -jar yuicompressor.jar "%%a" -o "deploy\%%a"

Upvotes: 1

Related Questions