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

Disable sha1 cache busting for HTML Imports #1073

Closed
morethanreal opened this issue May 27, 2014 · 3 comments
Closed

Disable sha1 cache busting for HTML Imports #1073

morethanreal opened this issue May 27, 2014 · 3 comments

Comments

@morethanreal
Copy link

Imagine a config that includes a.html and b.html:

a.html:

<link href="b.html" rel="import">
<!-- register custom element x-a -->

b.html:

<!-- register custom element x-b -->

When karma generates context.html, it appends all paths with ?sha1. The above config would throw an error where x-b is registered twice, because b.html was loaded twice, once from context.html and once from a.html since the path was different.

Since using HTML imports to resolve dependency is a very common pattern, perhaps karma should not cache bust resources loaded with HTML Imports?

@pkozlowski-opensource
Copy link
Member

@morethanreal I see the problem, but I'm not sure if making Karma aware of HTML imports is the best strategy. The thing is that Karma processor would have to scan all the HTML files, parse out URLs to the imports and then exclude those files. It is doable but sounds a bit hairy.

But I think we can make all those things working soothly if partials (imports) are served by Karma but not included by default. This is possible with the syntax for files described here: http://karma-runner.github.io/0.12/config/files.html. In your case it could look something like this:

files: [
 'a.html'
 {pattern: 'b.html', included: false}
],

I hope that this solves the immediate problem but if there are any enhancements that we could add, I would be happy to look into those. Would the above work for you?

@pkozlowski-opensource
Copy link
Member

@morethanreal oh, I've just bumped into your comment here: Polymer/polymer#513 (comment) which basically says the same thing as I'm suggesting above :-)

One again, I'm not sure if scanning all the HTML files to detect HTML import URLs is the best strategy for Karma as it could slow down tests....

@dignifiedquire
Copy link
Member

I don't think this is something that karma should be doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants