Closed
Conversation
Member
|
一个 PR 请仅专注于一个特定的方面,不要夹杂大量更改,以免干扰 PR 审查 |
Collaborator
|
感谢你的提交,但目前HMCL-docs的页面是会缓存的,我理解不需要使用 service worker 额外增加缓存。 |
Contributor
Author
该 PR 所采用的方案,确实可以借助 service worker,在 HTML 内容未发生变化的情况下避免额外的服务器请求。但与此同时,这一实现需要引入了基于 Ruby 的自定义插件为静态资源计算 hash,从而在一定程度上增加了系统复杂度并降低了整体可维护性。 最初考虑在浏览器端引入缓存机制,是由于境外访问文档站时,在切换皮肤时往往需要等待较长时间才能生效,因此才探索通过 service worker 优化体验。 另外,想进一步确认一下:后续是否有为文档站引入 CDN 的规划?如果有,这类问题或许可以通过 CDN 更直接地得到缓解。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
支持浏览器缓存
描述
通过为静态资源添加 hash 参数结合 service worker 实现浏览器端缓存。
改动
{{ '/assets/js/demo.js' | hash_file }}https://cache-docs.hmcl.workers.dev
close #416