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

Only the first @apply gets the styles #34

Open
enjikaka opened this issue Jun 1, 2017 · 8 comments
Open

Only the first @apply gets the styles #34

enjikaka opened this issue Jun 1, 2017 · 8 comments

Comments

@enjikaka
Copy link

enjikaka commented Jun 1, 2017

:root {
  --gridify-media-information: {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    align-items: center;
    justify-content: center;
    transform: translateY(40vw);
  }
}

.type--video .media-information {
   @apply --gridify-media-information;
}

@media (orientation: portrait) and (min-aspect-ratio: 1/1) and (max-aspect-ratio: 1/1) {
   .type--album .media-information {
      @apply --gridify-media-information;
   }
}

produces;

.type--video .media-information {
   position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    align-items: center;
    justify-content: center;
    transform: translateY(40vw);
  }
}

@media (orientation: portrait) and (min-aspect-ratio: 1/1) and (max-aspect-ratio: 1/1) {
.type--album .media-information {}
}
@pascalduez
Copy link
Owner

pascalduez commented Jun 1, 2017

Hi @enjikaka,

what version of postcss-apply are you using?
The latest 0.8.0 fixes some issues with nested declarations.

No warning in console/shell?
postcss-reporter is nice to have in your pipeline.

@enjikaka
Copy link
Author

enjikaka commented Jun 1, 2017

@pascalduez Using cssnext, it seems to be at 0.3.0 :(

Didn't get any warnings or errors no. Just an empty block.

@pascalduez
Copy link
Owner

It's most likely that postcss-apply will be removed from cssnext, so I doubt it will be upgraded.

You can just override it: npm i postcss-apply@latest -D.

@pascalduez
Copy link
Owner

pascalduez commented Jun 1, 2017

@enjikaka You might be interested to know that custom property sets and the @apply rule are not in good shape, at the spec level: https://github.com/pascalduez/postcss-apply#web-platform-status

@jarodtaylor
Copy link

You might be interested to know that custom property sets and the @apply rule are not in good shape, at the spec level: https://github.com/pascalduez/postcss-apply#web-platform-status

That makes me sad, @pascalduez :(

It's so useful.

nainemom added a commit to framevuerk/framevuerk that referenced this issue Jun 6, 2017
@ZeroCho
Copy link

ZeroCho commented Jun 9, 2017

@pascalduez I'm sad, too 😢 Is there any replacement for this among postcss plugins? postcss-loader@2 already does not support @apply feature... Or maybe any features that support mixins for cssnext?

@pascalduez
Copy link
Owner

pascalduez commented Jun 9, 2017

@ZeroCho I don't think there's a new spec reproducing the "mixin" kind of behaviour, the promoted one is now tight to custom elements and the shadow DOM... Crawl those links in the Readme, there's a ton of infos.

There's a postcss-mixin plugin, which replicates Sass like mixins.

@ZeroCho
Copy link

ZeroCho commented Jun 9, 2017

@pascalduez Thank you! Actually I already read all those links you provided, I felt that shadow DOM and ::part things were weird, so that's why I asked you about the things between @apply and shadow DOM.

I'll try postcss-mixin! Thank you again! 😄

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

No branches or pull requests

4 participants