gpt4 book ai didi

node.js - 将Gulp任务转换成Npm的脚本

转载 作者:太空宇宙 更新时间:2023-11-04 02:31:52 25 4
gpt4 key购买 nike

我已经使用Gulp有一段时间了,我刚刚发现了一种通过package.json的脚本运行一些Gulp任务的方法,例如browserify/watchify/less。例如:

"scripts": {
"watch": "npm run watch-js & npm run watch-less & npm run watch-server",
"watch-js": "watchify app/js/main.js -t -o static/bundle.js -dv",
"watch-less": "nodemon --watch app/less/*.less --ext less --exec 'npm run build-less'"
}

由于 browserify/watchify/less 是 native npm 软件包,我想知道如何重现/转换(无需编写自定义 bash/zsh 脚本)我的其他 Gulp 任务,例如 gulp-revgulp-s3 来与 npm 的脚本配合使用?

最佳答案

您已经可以从 CLI 调用特定的 gulpfile 任务。只需将它们放入您的 npm 脚本中即可。

Tasks can be executed by running gulp <task> <othertask>. Just running gulp will execute the task you registered called default. If there is no default task gulp will error.

https://github.com/gulpjs/gulp/blob/master/docs/CLI.md#tasks

关于node.js - 将Gulp任务转换成Npm的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25981322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com