Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为 app.css 的引入增加 hash #16498

Closed
Jeff-Tian opened this issue Sep 8, 2024 · 2 comments
Closed

为 app.css 的引入增加 hash #16498

Jeff-Tian opened this issue Sep 8, 2024 · 2 comments
Labels
T-h5 Target - 编译到 H5

Comments

@Jeff-Tian
Copy link
Contributor

Jeff-Tian commented Sep 8, 2024

这个特性解决了什么问题?

48d493d3205ee159a3d8eb92a661666

请问 taro build:h5 之后的 html 页面,引用 app.css 时,有办法设置一个 hash 吗?原因是改了 app.css 之后,浏览器缓存导致不能及时生效。

代码里是通过 import 引入的:

5a23588c408a3e56b4080243afc2e58

这个 API 长什么样?

默认开启 hash

即可以是这样的引入:

<link href="/css/app.a0123bcde.css" />
@TheKonka TheKonka added the T-h5 Target - 编译到 H5 label Sep 8, 2024
@github-project-automation github-project-automation bot moved this to Padding in H5 Sep 8, 2024
This was referenced Sep 14, 2024
@x011223
Copy link

x011223 commented Oct 18, 2024

// config/index.js

  h5: {
    // ....
    miniCssExtractPluginOption: {
      filename: 'css/[name].[hash].css',
      chunkFilename: 'css/[name].[chunkhash].css',
    },
  },

@Jeff-Tian
Copy link
Contributor Author

Works like a charm, Thanks!

@github-project-automation github-project-automation bot moved this from Padding to Done in H5 Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-h5 Target - 编译到 H5
Projects
Archived in project
Development

No branches or pull requests

3 participants