绑定GruntJS命令(Bind GruntJS commands)
我正在为GruntJS使用uglify,指南针和副本。 现在我想将它们全部绑定到一个命令,所以我不必输入“grunt uglify”,“grunt compass”和“grunt copy”,而只需输入“grunt project”之类的内容。 这有可能吗?
I am using uglify, compass and copy for GruntJS. Now I would like to bind all of them to one single command, so I don't have to type in "grunt uglify", "grunt compass" and "grunt copy", but instead only something like "grunt project". Is this possible somehow?
最满意答案
您可以使用registerTask围绕多个任务创建别名。
例:
grunt.initConfig({ clean: /* ... */, copy: { /* ... */ }, uglify: { /* ... */ } }); grunt.registerTask('build', ['clean', 'uglify','copy']);然后从命令行调用grunt build (或者你选择调用它的任何东西)。
You can use registerTask to create an alias around several tasks.
Example:
grunt.initConfig({ clean: /* ... */, copy: { /* ... */ }, uglify: { /* ... */ } }); grunt.registerTask('build', ['clean', 'uglify','copy']);Then just call grunt build (or whatever you choose to call it) from the command line.
更多推荐
发布评论