Question

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))
Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top