简体   繁体   English

如何通过命令gulp从另一个JS文件使用gulpfile.js

[英]How can I use gulpfile.js from another JS file by command gulp

I want to use my compiling scripts in different projects as a submodule of GIT modules. 我想在不同项目中使用我的编译脚本作为GIT模块的子模块。

I added the submodule into a directory named build , and there is a gulpfile.js in the build dir. 我加入了子模块到指定的目录build ,并有一个gulpfile.jsbuild目录。

I created another gulpfile.js in the root dir of the project, then using this gulpfile.js to invoke the real gulpfile.js in build dir. 我在项目的根目录中创建了另一个gulpfile.js ,然后使用该gulpfile.js调用了build目录中的实际gulpfile.js

After I running the gulp command, I got an error message that told me that "Task 'default' is not in your gulpfile". 运行gulp命令后,出现一条错误消息,告诉我“任务'default'不在您的gulpfile中”。

I don't want to manage any dependence in each project that going to use this build , I just want to find out a way to invoke the real gulpfile . 我不想管理将要使用此build每个项目中的任何依赖关系,我只想找到一种调用真正的gulpfile

What shall I do? 我该怎么办? Thanks a lot. 非常感谢。

You may need to either set a gulp cli config file .gulp.json with a property setting the path to your custom gulpfile, or use gulp --gulpfile [path] . 您可能需要设置具有设置自定义gulpfile路径的属性的gulp cli配置文件.gulp.json,或使用gulp --gulpfile [path] More on this on the github readme page of gulp-cli https://github.com/gulpjs/gulp-cli/blob/master/README.md 有关更多信息,请参见gulp-cli的github自述文件页面https://github.com/gulpjs/gulp-cli/blob/master/README.md

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

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