我想使用grunt-hash插件重命名我的js文件.此插件创建一个包含重命名文件映射的新文件:
hash: {
options: {
mapping: 'examples/assets.json', //mapping file so your server can serve the right files
Run Code Online (Sandbox Code Playgroud)
现在我需要通过替换所有用法来修复这些文件的链接(将'index.js'重命名为'index- {hash} .js'),所以我想使用grunt-text-replace插件.根据文档我需要配置替换:
replace: {
example: {
replacements: [{
from: 'Red', // string replacement
to: 'Blue'
}]
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能读取json映射文件以获取每个文件的{hash}值并提供它们来替换任务?