aseemk / requireDir

Node.js helper to require() directories.
MIT License
484 stars 60 forks source link

with require do I need gulp required on all tasks files? #35

Closed Riskbreaker01 closed 8 years ago

Riskbreaker01 commented 8 years ago

all my require requireDir('path/dir') need this in their files:

var gulp = require('gulp');

Is there a way that require('gulp') only has the need to set this in the gulpfile.js and not on every individual files in the path?...I feel like there should be a way not to have to add these to all the files that are added but have to in this case. It seems to make process delay.

aseemk commented 8 years ago

There isn't any way today.

It's unlikely this is delaying your process. Node caches requires, so Gulp is only really getting required once under the hood.

You could confirm this by adding console.time and console.timeEnd calls before the requires.

Riskbreaker01 commented 8 years ago

I guess that makes sense ...maybe i just didn't want to add that repeated on every task pages, but if it has to be done than so be it

aseemk commented 8 years ago

I hear you. =) The more I think about this issue btw, the more it feels like it'd be a great feature for Gulp to have (being able to automatically require a file in every task). Mocha has this (--require):

http://mochajs.org/#usage

So I encourage you to ask on a Gulp mailing list, etc. Good luck!