-
Notifications
You must be signed in to change notification settings - Fork 21
Using multiple custom-selectors in one selector does not work #19
Comments
https://github.com/postcss/postcss-custom-selectors#multiple-selectors I will consider suppor it. |
Nice :) |
I'm pretty sure this worked before, might be a cssnext update that caused this but: @custom-selector :--foobar .foo, .bar;
@custom-selector :--baz .baz;
:--foobar > :--baz {
color: red;
} Isn't working for me anymore and now produces: .foo,
.bar {
color: red;
} Instead of: .foo > .baz,
.bar > .baz {
color: red;
} Is this the same limitation or just a regression? cssnext 1.7.1 with postcss-custom-selectors 2.1.0 |
Okay the comment above is definitely a cssnext problem, seems to be working with plain postcss-custom-selectors. |
So the case above was a playground/firefox issue. I tried to simplify the selectors I got and now have a failing case which definitely fails in postcss-custom-selectors and probably isn't related to cssnext. input.css: @custom-selector :--fizzbuzz .fizz, .buzz;
@custom-selector :--foobar .foo, .bar;
:--fizzbuzz > :--foobar {
color: red;
} output.css: .fizz > .foo,
.fizz > .bar,
.buzz > .foo,
.buzz > .bar {
color: red;
} actual.css: .fizz > .foo,,
.fizz > .bar,
.buzz > .foo,
.buzz > .bar {
color: red;
} |
It seems related to this part https://github.com/postcss/postcss-custom-selectors/blob/e020e3220644d1975b4dc7102d1acb1e0bec38a0/index.js#L21 which does not reset the list for each plugin executions |
I am on working on this bug. |
@yisibl I am going to completely rewrite this plugin with the codebase of postcss-selector-matches (so using babel). This will be better, are you ok with that? |
+1, Mama no longer has to worry that I don't use es 2015 often enough. :) @MoOx Possible to allow cssnext config file to be written in es 2015 too? Maybe pass that file to babel instead of requiring it directly? |
I think this is the right way to do it, the custom selector spec even says that it expands into |
Almost done. PR is coming really soon. Some fixes will be pushed in |
This commit include a refactoring based on postcss-selector-matches and add the ability to limit the transformation to :matches() usage. Also in this commit: - add eslint - rewrite using babel (es6/7) - fixtures files removed in favor of es6 template string - should also fix some weird “undefined” warnings Close #19
Complete rewrite has just been pushed as a PR #27 |
This commit include a refactoring based on postcss-selector-matches and add the ability to limit the transformation to :matches() usage. Also in this commit: - add eslint - rewrite using babel (es6/7) - fixtures files removed in favor of es6 template string - should also fix some weird “undefined” warnings Close #19
This commit include a refactoring based on postcss-selector-matches and add the ability to limit the transformation to :matches() usage. Also in this commit: - add eslint - rewrite using babel (es6/7) - fixtures files removed in favor of es6 template string - should also fix some weird “undefined” warnings Close csstools/postcss-custom-selectors#19
For example this:
compiles to this:
instead of this:
The text was updated successfully, but these errors were encountered: