Comment ajouter du texte à plusieurs fichiers à l'aide grognement fichiers ajouterannexant texte à plusieurs fichiers à l'aide 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'
}
]
}
}
})
si j'écris la fonction de cette façon, pour annexant à plusieurs fichiers, il casse une erreur.
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'
}
]
}
}
})
je reçois l'erreur suivante:
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.
annexant juste pour un seul fichier fonctionne, mais pas pour les fichiers multiples, quelque chose que je fais mal ici.
J'ai utilisé la concat grunt contrib, mais je suis un nouveau grunt, je ne sais pas comment fusionner ces deux plugins les uns aux autres. – patz
Y at-il un moyen que je peux utiliser contact grunt contrib et ajouter ou préfixer les balises en utilisant cela. – patz
oui, regardez l'option 'banner' et' footer': https://github.com/gruntjs/grunt-contrib-concat#banner – jmartins