Polymer HTML Import caching

2019-06-25 16:40发布

问题:

I want to make sure that the browser gets the latest version of my custom elements via HMLT import. Right now, I am attaching a version query string:

e.g.

<link rel="import" href="/dist/elements/my-element.html?v=12345">

This is a common practice for JS and CSS files, and I am wondering if this is valid approach for HTML Imports as well?

回答1:

Yes, the same principles apply.

As an example, take a look at the source of http://www.polymer-project.org/. At the time of this writing, it contains <link rel="import" href="http://www.polymer-project.org/elements/homepage_elements.vulcanized.html?20140828">.

P.S. Described query parameter is not used at http://www.polymer-project.org/ anymore.