Reputation: 13376
I know it's a basic question, but I couldn't find a proper answer.
Is there a way of storing a list of my project's source files in a JSON file and load it on gulpfile.js
? For example, instead of doing:
gulp.src(['a.js', 'b.js'])
Do something like:
var sources = some_load_file_func('sources.json');
gulp.src(sources.js_files))
Upvotes: 14
Views: 14984
Reputation: 39570
A gulpfile is just node, and in node you can simply use require
on JSON files, like so:
var sources = require('sources.json');
Now sources will be an object (or whatever is in your JSON file).
Upvotes: 29