Grunt 添加许多 v= 到文件名
Grunt add many v= to file name
我是 G运行t(或任何任务管理器)的新手 ;)
我对文件名 ex 有疑问:styles.css?v=1feafc7?v=1feafc7&v=1feafc7&v=8aa4f4b
G运行t 在我 运行 多次任务时加我很多 v=
。
我预计它将只保留最新版本,而不是所有版本。
这是我的 hash_res
配置
hash_res: {
html: {
options: {
resDir: './build',
resReg: [
/(css\/[^.]+\.css)(\??)/g,
/(images\/[^.]+\.(?:png|gif|jpg))(\??)/g
]
},
files: [
{
expand: true,
cwd: 'build',
src: ['*.html'],
dest: 'build'
}
]
}
}
插件 -> grunt-hash-res
好的,我找到了解决方案 here
The problem you're seeing is because the task is processing the same
files over and over. It's recommended that the process for running
these tasks is:
copy files to a new folder -> process files in there -> deploy that version of the code
我是 G运行t(或任何任务管理器)的新手 ;)
我对文件名 ex 有疑问:styles.css?v=1feafc7?v=1feafc7&v=1feafc7&v=8aa4f4b
G运行t 在我 运行 多次任务时加我很多 v=
。
我预计它将只保留最新版本,而不是所有版本。
这是我的 hash_res
配置
hash_res: {
html: {
options: {
resDir: './build',
resReg: [
/(css\/[^.]+\.css)(\??)/g,
/(images\/[^.]+\.(?:png|gif|jpg))(\??)/g
]
},
files: [
{
expand: true,
cwd: 'build',
src: ['*.html'],
dest: 'build'
}
]
}
}
插件 -> grunt-hash-res
好的,我找到了解决方案 here
The problem you're seeing is because the task is processing the same files over and over. It's recommended that the process for running these tasks is:
copy files to a new folder -> process files in there -> deploy that version of the code