在git预提交钩子中聚合和丑化javascript [英] Aggregating and uglifying javascript in a git pre-commit hook
问题描述
我使用 ready.js
将JS文件聚合到 all.js
文件中(没有Google的Closure编译器),然后使用 uglify-js
来缩小和模糊化代码。
但是,我想我做错了。
我的 .git / hooks / pre-commit
文件看起来像这样:
#!/ bin / sh
readyjs〜/ Sites / backbone / js / javascripts /〜/ Sites / backbone / js / --nojslint -ounderscore.js,backbone.js --nocompiler
uglifyjs -nm -o〜/ Sites / backbone / js / all.min.js〜/ Sites / backbone / js / all.js
#Commit
exit
我应该不在这里使用简单的Bash吗?还有别的什么我做错了吗?
我的心理能力建议你的脚本不可执行;尝试
chmod + x .git / hooks / pre-commit
pre>
I'm using
ready.js
to aggregate JS files into anall.js
file (without Google's Closure Compiler), and then usinguglify-js
to minify and obfuscate the code. I'd like to do all of this in a pre-commit hook.However, I think I'm doing something wrong.
My
.git/hooks/pre-commit
file looks like this:#!/bin/sh readyjs ~/Sites/backbone/js/javascripts/ ~/Sites/backbone/js/ --nojslint -o "underscore.js, backbone.js" --nocompiler uglifyjs -nm -o ~/Sites/backbone/js/all.min.js ~/Sites/backbone/js/all.js # Commit exit
Should I not be using simple Bash here? Is there something else I'm doing wrong? This step seems to be skipped entirely.
解决方案My psychic powers suggest that your script isn't executable; try doing
chmod +x .git/hooks/pre-commit
这篇关于在git预提交钩子中聚合和丑化javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!