如何从包脚本开始和构建中运行gulp命令

时间:2019-02-27 02:13:36

标签: angular gulp

  1. 嗨,我需要通过npm start运行gulp命令。

  2. 当我使用命令运行gulp时,它可以工作,但是我需要运行命令 通过npm start或ng build命令自动

package.json

{
  "name": "cfch",
  "version": "0.0.0",
  "main": "gulpfile.js",
  "scripts": {
    "ng": "ng",
    "start": "gulp && ng serve --proxy-config proxy.conf.json", //it's working
    "build": "gulp && ng build --prod–aot && tar -zcvf archive.tar.gz dist/prod/*", //not working while type command ng build
    "test": "echo \"Error: no test specified\" && exit 1",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "gulp": "gulp"
  },
   "dependencies": {
    "gulp-htmlmin": "^5.0.1",
    "gulp-imagemin": "^5.0.3",
    "gulp-minify-css": "^1.2.4",
    "gulp-uglify": "^3.0.1",
},
  "devDependencies": {
    "gulp": "^3.9.1",
}

1 个答案:

答案 0 :(得分:1)

您可以将gulp安装为Dev依赖项。然后添加gulp命令以&&开头。例如

“开始”:“大嘴<命令> && ng服务”