Reputation: 9893
I want to read a file with grunt like this:
grunt.file.read(filepath [, options])
but my filepath is a regex:
src/dist/res/js/*.index.js
so I want to find all file end with .index.js
, then read it.
Upvotes: 0
Views: 99
Reputation: 5689
Grunt mostly is a tool with declarative configs, so if you need to read a sequence of files, you're probably doing something wrong.
Anyway your task can be implemented with next snippet
grunt.file.expand('src/dist/res/js/*.index.js').forEach((filePath) => {
console.log(grunt.file.read(filePath))
})
Upvotes: 1