使用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.
追加到单个文件是有效的,但对于多个文件无效, 这里我做错了什么。
banner
和footer
选项:https://github.com/gruntjs/grunt-contrib-concat#banner - jmartins