postcss-apply icon indicating copy to clipboard operation
postcss-apply copied to clipboard

Using postcss-apply in Polymer 3 with webpack

Open sebastianroming opened this issue 6 years ago • 3 comments

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?

sebastianroming avatar Apr 13 '18 09:04 sebastianroming

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?

pascalduez avatar Apr 13 '18 16:04 pascalduez

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 avatar Apr 15 '18 10:04 sebastianroming

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:

  • clone the repo and change the branch to postcss-apply-sample
  • run yarn to install dependencies
  • run yarn dev:module to create a local development server at localhost:3000

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.

sebastianroming avatar Apr 16 '18 05:04 sebastianroming