grunt-text-replace
grunt-text-replace copied to clipboard
Added support for destination to be a function
So I needed the ability to also change the filename of the replaced files, so I added the ability to specify destination as a function, for example:
replace: {
all: {
src: ['foo.json', 'bar/*.json'],
dest: function (input) {
return input + '.j2';
},
replacements: [{
from: 'foo',
to: 'bar'
}]
}
}
Hope that's cool :)
Thanks for this pull request. It is very useful for me for a quick and dirty templating mechanism.
This will replace the texts from files containing .template to the corresponding file without .template For example It will replace the texts from foo.template.css to foo.css or blah.template.js to blah.js
src: ['app/assets/**/*.template.*'],
dest: function (input) {
return input.replace('.template', '');
},
replacements: [{
from: 'foo',
to: 'bar'
}]