grunt-file-append を使用して複数のファイルにテキストを追加する方法
https://www.npmjs.com/package/grunt-file-append
grunt.initConfig({
file_append: {
default_options: {
files: [
{
append: "text to append",
prepend: "text to prepend",
input: '/path/to/input/file'
output: 'path/to/output/file'
}
]
}
}
})
このように関数を記述すると、複数のファイルに追加するためにエラーが発生します。
grunt.initConfig({
file_append: {
default_options: {
files: [
{
append: "text to append",
prepend: "text to prepend",
input: './path/to/input/*.html'
output: 'path/to/output/*.html'
}
]
}
}
})
次のエラーが表示されます。
Running "file_append:default_option" (file_append) task
>> Source file "./path/to/output/*.html" not found.
Warning: Task "file_append:default_option" failed. Use --force to continue.
Aborted due to warnings.
単一のファイルへの追加は機能しますが、複数のファイルでは機能しません。ここで間違っていることは何でもありません。