Run gulp task after NPM package install

北城以北 提交于 2019-12-13 17:18:44

问题


I've developed a small package that I'm serving from a github repo. It's basically a UI Library and it has only a SCSS file.

my-ui-library
-- src/styles.scss

I would like that after the installation the package run itself a gulp task that compiles the CSS, and move it to other location.

The desired output, after the gulp task is run, is something like this:

my-ui-library
-- src/styles.scss
-- styles.scss

I've included some scripts

"scripts": {
  "postinstall": "gulp"
}

I can´t find the way to run gulp after the install of the package.

Any help will be appreciated.


回答1:


In your postinstall script you can use the --gulpfile flag for gulp to specify where your other gulp file to use is.

"scripts": {
  "postinstall": "gulp --gulpfile <path-to-gulpfile>"
}


来源:https://stackoverflow.com/questions/37353703/run-gulp-task-after-npm-package-install

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!