NPM软件包安装后运行gulp任务 [英] Run gulp task after NPM package install
本文介绍了NPM软件包安装后运行gulp任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开发了一个小程序包,该程序包是从github存储库中提供的.它基本上是一个UI库,只有一个SCSS文件.
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
我希望安装后,程序包自己运行一个gulp任务,该任务会编译CSS,然后将其移动到其他位置.
I would like that after the installation the package run itself a gulp task that compiles the CSS, and move it to other location.
运行gulp任务后,所需的输出是这样的:
The desired output, after the gulp task is run, is something like this:
my-ui-library
-- src/styles.scss
-- styles.scss
我已经包含了一些脚本
"scripts": {
"postinstall": "gulp"
}
安装软件包后,我找不到运行gulp的方法.
I can´t find the way to run gulp after the install of the package.
任何帮助将不胜感激.
推荐答案
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>"
}
这篇关于NPM软件包安装后运行gulp任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文