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
External stylesheets cause message to be logged in browser. #1712
Comments
My conclusion is that when you open a component file (.css, .js) in Chrome, it will try to interpret as document (showing output on the screen), instead of interpreting it as its native MIME type. |
Did you have a |
@imskull type="css" should NOT be removed, otherwise the CSS does not load. See also documentation. Isn't this a Chrome issue? Or should we just live with it? |
I do not think it's correct with a |
Just for the record using paper-drawer-panel is affected by this issue due to this line |
I get this issue on browser reload, but not inital load. |
It seems to happen randomly. Sometimes I get zero "errors" in my console, sometimes Chrome spasses out and shows "errors" for some or every element, including Polymer's own elements, that uses Is this another way of telling us to vulcanize our Polymer webapplications? Or does this happen when one has vulcanized aswell? |
Confirmed for me too
|
Is the message a warning or an error? In other words, is the element's CSS applied? |
@ssiano: Neither, it's just a regular message. The CSS is applied. |
Thanks @mdevdk. Among the iron and paper elements, the following have external stylesheets: $ grep -lr '<link rel="import" type="css"' . | grep -v 'demo|test' | sort |
I'm a little confused here as to why this is concerning - it's just a warning, no? And secondly, isn't this basically a fundamental limitation behind the way that the new shim works in order to do its work? As long as If I'm wrong in my assumptions or I just flat-out missed the whole point, please let me know! 😄 |
@vsimonian The fact that there is a warning indicates that at the very least that there is something unusual happening. I understand why it's happening. I don't think simply ignoring the warning is a good long term solution. Probably a bug report should be opened against Chromium if this is in fact the correct long term solution. If my project is vulcanized with everything inlined into 1 file this problem will go away, but I don't think this is documented anywhere. Again it's obvious as to why this is happening once you have some basic fundamentals under your belt but I believe that one of Polymer strengths is to allow non-professional front-end developers to create great, beautiful UIs. This console message might be concerning/misleading to newcomers. |
@tregoning I think I'm beginning to understand! Thanks for taking the time to explain. Perhaps, then, if I'm understanding this correctly, this should be a docs issue in the meantime? I feel we need input (maybe you've got a bit of insight to share?) as to what's a realistic time/point at which the way this shim works can be changed to follow a less "alarming" route. My gut feeling is that this has a lot to do with browser support for web components/shadow DOM/HTML imports, which right now is still in its infancy in practical terms (except Chrome, gotta love Chrome). |
PS Chrome is the one complaining here :) |
Funnily enough, yes. :) To sum up what I'm getting out of this discussion is:
|
Would a solution be to create a -styles element, similar to paper-styles where it's basically an empty element but with a collection of common styles inside |
@mdevdk I think that may be a possible solution, but I have a few concerns. I'm still torn here. Ideally, I'd like to wait for browser support and see this as a documentation issue in the meantime. However, the negotiation between Google, Mozilla, Apple, and Microsoft around the Web Components standard has been fraught with tension, and, in my observation, agreements have been hard to come by. Thus, realistically speaking, even waiting for browser support may become a long-term proposition. It would be easier from the side of implementation complexity to live with the warning. However, as @tregoning pointed out, the reason the warning is a problem is that unless you know why the error is happening, it can be confusing and potentially lead to a developer wasting their time trying to fix a problem that isn't really there. Now, let's say we make some sort of custom element. This may avoid the warning, but I'm concerned as to:
If there's an easy way around the warning, hats off to whoever puts it in. However, I'm not so sure there's such a silver bullet, and I am leaning on the side of believing that trying to avoid this warning may end up with a significantly more complex or confusing result than the warning itself. I'd love to hear some input from one of the Polymer engineers and see what they have to say. |
Replacing |
Note that starting in 1.1.0, It does have some drawbacks (most significant of which is that it doesn't accept bare CSS files, they have to be wrapped in a However, I think we can close this bug since the offending mechanism is deprecated. |
Polymer needs to support bare external CSS files generated by CSS preprocessors. Let's continue this conversation on #2429. |
When using an external stylesheet in Chrome, an info message is printed to the console that says:
Resource interpreted as Document but transferred with MIME type text/css
The text was updated successfully, but these errors were encountered: