質問

I’m trying to make a Git hook bash script that minifies my JavaScript code. So far I have come up with this, it just prints the minified JavaScript when I run the script:

#!/bin/sh
find js/ -type f -maxdepth 3 -name \*.js -exec uglifyjs {} +
exit

I’m not sure how to give the uglifyjs any commands and what the output filename should be.

In the terminal it would be:

uglifyjs -o js/app.js js/app.js

So I’m not sure how to reference the file names etc?

役に立ちましたか?

解決

Say:

find js/ -type f -maxdepth 3 -name \*.js -exec uglifyjs -o {} {} \;

instead. Note the ; instead of the + after the command.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top