grunt-text-replace
grunt-text-replace copied to clipboard
Folders with a period in the title are treated like files, error is thrown
When running replace on a source target that contains a folder with a period in the title, the following error is thrown.
Warning: Unable to read "../testing/foo.bar" file (Error code: EISDIR). Use --force to continue.
In this case, foo.bar is a folder, not a file, but the script is attempting to open it as if it were a file.
I've found that the issue is caused by the way that grunt.file.expand is called and then iterated through in the replaceFileMultiple function. When I updated the grunt.file.expand call to include only files it fixes the issue. The updated line should look like this:
var sourceFiles = grunt.file.expand({'filter': 'isFile'}, settings.src);