ディレクトリとそのサブディレクトリにあるすべてのファイルで、grunt-string-replace を使用して文字列を置き換えたい
たとえば、これらすべてのファイルで:
dist/templates_and_modules/templates/template1/template1.php
dist/templates_and_modules/templates/template2/template2.php
dist/templates_and_modules/modules/module1.php
dist/templates_and_modules/modules/module1.php
交換したい
/*remove->*/
と:
/*
と
/*<-remove*/
と
*/
明示的に定義されたファイルを使用すると、次のように機能します。
strrep: {
dist: {
files: {
'<%= yeoman.dist %>/templates_and_modules/templates/template1/template1.php':
'<%= yeoman.dist %>/templates_and_modules/templates/template1/template1.php'
},
options: {
replacements: [
{
pattern: '/*remove->*/',
replacement: '/*'
},
{
pattern: '/*<-remove*/',
replacement: '*/'
}
]
}
}
}
しかし、ディレクトリ内のすべてのファイルで動作させることはできません。