Reputation: 712
I want to run an index.js
file as a part of my gulp process. I could add node index.js
through something like gulp-shell as described in this thread (How to run bash commands in gulp?) but it seems there should be an easier way.
I figured there would be a plugin called gulp-node
or something to do this but it doesn't exist. How do others do it without turning your initial script into a gulp plugin, which seems intrusive?
Upvotes: 1
Views: 2108
Reputation: 2188
You can use var data = require('./path/to/index')
to load/run the index.js
module in your Gulp task and send any exported information to data
. You can read more about require
and Node.js modules here.
Upvotes: 3