【问题标题】:Grunt add many v= to file nameGrunt 将许多 v= 添加到文件名
【发布时间】:2020-08-18 19:09:23
【问题描述】:

我是 Grunt(或任何任务管理器)的新手 ;)

我对文件名 ex 有疑问:styles.css?v=1feafc7?v=1feafc7&v=1feafc7&v=8aa4f4b

当我多次运行任务时,Grunt 会添加很多 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

【问题讨论】:

    标签: javascript file gruntjs version


    【解决方案1】:

    好的,我找到了解决方案here

    您看到的问题是因为任务正在处理相同的 一遍又一遍的文件。建议运行的进程 这些任务是:

    copy files to a new folder -> process files in there -> deploy that version of the code

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多