question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gulp does not support sub projects

See original GitHub issue

You cannot have a gulpfile.js call another gulpfile.js from another project in a subfolder of your project. Consider this canned example:

$ git init
$ git submodule add --force https://github.com/google/web-starter-kit.git 
$ git submodule add https://github.com/driftyco/ionic.git
$ pushd ionic/; npm install; popd
$ pushd web-starter-kit/; npm install; popd
$ cat >> gulpfile.js << EOF
var gulp = require('gulp');
var osScaffold = require('./web-starter-kit/gulpfile');
var njsApp = require('./ionic/gulpfile');

gulp.task('default', function() {
  //what goes here
});
EOF
$ npm install gulp

$ gulp
[15:42:49] Using gulpfile ~/.tmp/gulpfile.js
[15:42:49] Starting 'default'...
[15:42:49] Finished 'default' after 35 μs

This of course does nothing, but how could it do any thing. I would need to call the default task of each sub project, but they have been replaced by the root project’s default task.

Other problems arise like the following code in a child project:

gulp.task('tarball', function() {
  return gulp.src(['**/*')
    .pipe(tar('subproject.tar'))
    .pipe(gzip())
    .pipe(gulp.dest('./dist'));
});

This code will output a tarball of not just the subproject where it lies, but also the root project and the other project. Also it will put that tarball in the dist folder of the root project, not the dist folder of the subproject.

Only way that I know of to do sub projects would be to synchronously fork and call gulp on each gulpfile.js of the sub projects.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tobias-neubertcommented, Jan 9, 2015

I found gulp-hub for that. Simply create a route gulpfile.js like this.

var gulp = require('gulp');
var hub = require('gulp-hub');
hub(['bas-amqp/gulpfile.js']);
0reactions
trusktrcommented, Feb 8, 2018

Ahah! I spoke too soon. Gulp 4 is coming out with tasks as exports. This is awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use a gulp task in mulitple projects - Stack Overflow
I made reusable gulp tasks since we had multiple frontend projects all using gulp. The best way I found was to create a...
Read more >
gulp-typescript - npm
gulp -typescript. A gulp plugin for handling TypeScript compilation workflow. The plugin exposes TypeScript's compiler options to gulp using ...
Read more >
The Working Programmer - How To Be MEAN: Taking a Gulp
This will make sure that Gulp is referenced in the package.json file as a developer dependency, so that if you pull down the...
Read more >
Gulp Tasks - Aurelia
Gulp tasks in a CLI application are plain Gulp v4 tasks. Gulp v4 brings gulp.series and gulp.parallel which makes Gulp tasks easier and...
Read more >
Gulp | IntelliJ IDEA Documentation - JetBrains
js file, and supports running and debugging tasks. Gulp.js tasks can be run from the tasks tree in the dedicated Gulp Tool Window,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found