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.