绑定GruntJS命令(Bind GruntJS commands)

编程入门 行业动态 更新时间:2024-10-28 00:16:59
绑定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.

更多推荐

本文发布于:2023-08-03 12:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1386719.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   命令   commands   GruntJS   Bind

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!