pascalduez / postcss-apply

PostCSS plugin enabling custom properties sets references
The Unlicense
164 stars 12 forks source link

Using postcss-apply in Polymer 3 with webpack #41

Open sebastianroming opened 6 years ago

sebastianroming commented 6 years ago

Hello there,

If I declare some styles like this:

:host {
  --test-elem: {
    color:#F00;
  }
}
[...]
span.account-name {
  @apply --test-elem;
}

it works pretty well. But if I use

:host {
  --app-drawer-width: 65px;
  --app-drawer-scrim-background: #fff;
  --app-drawer-content-container: {
    background-color: #263448;
  }
}

like I should, with polymer elements (see app-drawer polymer 3 elem), it doesn't work. that's annoying :( Do you have any solution / help for this?

pascalduez commented 6 years ago

Hi,

please provide a reduced and ready to debug repo or sample, so that we can have chance to try to debug. I have no experience with Polymer though, so dunno. Are Polymer styles using PostCSS?

sebastianroming commented 6 years ago

Polymer doesn't natively use PostCSS. I use the Polymer Skeleton from PolymerX and they use PostCSS.

I'll provide a short sample for you tomorrow.

sebastianroming commented 6 years ago

I forked the Polymer Skeleton and created a small example for you:

https://github.com/sebastianroming/polymer-skeleton/tree/postcss-apply-sample

You need yarn to install and run:

You can see that the app-drawer doesn't get styled as defined in src/components/containers/sk-app/style.pcss, but the span.account-name does.