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

style include modules should be prepended before text in style #4770

Closed
dfreedm opened this issue Aug 3, 2017 · 4 comments
Closed

style include modules should be prepended before text in style #4770

dfreedm opened this issue Aug 3, 2017 · 4 comments

Comments

@dfreedm
Copy link
Member

dfreedm commented Aug 3, 2017

Somehow #2357 might have appeared again in 2.x.

@pdesjardins90
Copy link

So to reiterate this conversation, style modules in Polymer 2 are now appended after local shadow dom styles in an element, which can override those styles when css specificity is the same.

I realized that while migrating my app's elements, which all contained a css reset imported as a style module. My tweet was because I thought it was a normal new behavior (it's not a bug it's a feature right? 😛 )

While you guys fix that behavior, as a workaround, I'm trying to override the way Polymer templates get loaded following @kevinpschaaf 's snippet. I'm going on vacation next week though so more news on that workaround when I get back, for folks having the same problem.

@dfreedm
Copy link
Member Author

dfreedm commented Aug 4, 2017

Hmm, I made a style import and it appears to be placed before the elements' styling, as expected: http://jsbin.com/duwewuq/edit?html,output

Is there a different setup you would have? Do you mean <link rel="import" type="css"> style imports?

@dfreedm
Copy link
Member Author

dfreedm commented Aug 7, 2017

So, it looks like the ordering problem is only for <link rel="import type="css"> style imports:

Polymer v1: https://mercury-grenade.glitch.me/
Polymer v2: https://colorful-chalk.glitch.me

@dfreedm
Copy link
Member Author

dfreedm commented Aug 7, 2017

Ah, it is more subtle. In 1.x, the ordering of <template><style></style></template> and <link rel="import" type="css"> mattered, whereas in 2.x the css import is always last.

dfreedm added a commit that referenced this issue Aug 7, 2017
This is still slightly different from 1.x, which used ordering, but most
`<link rel="import" type="css">` style imports came before the template.

Fixes #4770
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