简体   繁体   English

如何在package.json中的项目目录中为gulp文件创建路径

[英]How to make a path for gulp file in project's directory in package.json

So I have a directory "node", where I run a lot of different projects, there are 2 directories, one is "examples", that provide some modules, and "projects", where I combine them to smth good. 因此,我有一个目录“节点”,在其中运行许多不同的项目,有2个目录,一个是“示例”(提供一些模块),另一个是“项目”,在这里我将它们组合在一起非常好。 And so, in one of projects I started to use gulp, but, all package.json "scripts" I saw was like test : 'gulp' and etc, and in my case it doses not see my one. 因此,在一个项目中,我开始使用gulp,但是,我看到的所有package.json“脚本”都像test : 'gulp'等,在我的情况下,它看不到我的一个。
node | +-- examples +-- projects | +-- 1 +-- 2 | +--gulpfile.js node | +-- examples +-- projects | +-- 1 +-- 2 | +--gulpfile.js What I can do, to set up my package.json to see the gulp file inside the "2" directory? node | +-- examples +-- projects | +-- 1 +-- 2 | +--gulpfile.js怎么办,设置package.json以查看“ 2”目录中的gulp文件?

I tried to set up a new package.json inside "2", but it makes node_modules download one more, and that's actually bad, however, it works, so there is no problem with gulp file. 我试图在“ 2”中设置一个新的package.json,但它会使node_modules再下载一次,这实际上很糟糕,但是,它可以工作,因此gulp文件没有问题。

I expect that gulpfile.js inside 2 will be found without new package json. 我希望2中的gulpfile.js可以在没有新包json的情况下找到。

Simplest way is to specify the gulpfile when you run gulp. 最简单的方法是在运行gulp时指定gulpfile。 Assuming you run from the node directory: 假设您从node目录运行:

gulp --gulpfile=projects/2/gulpfile.js

Gulp also supports a .gulp.json CLI configuration file where you can specify that command line flag so you don't have to repeat it every time you run it. Gulp还支持.gulp.json CLI配置文件,您可以在其中指定该命令行标志,这样就不必在每次运行时都重复它。 Check the documentation for more info. 查看文档以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM