postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
596 stars 77 forks source link

How do I import variables from npm package? #108

Closed pavelozavr closed 6 years ago

pavelozavr commented 6 years ago

Hi, I have an installed npm package with some variables, and I wanna use them inside my application. The plugin always crashes with the var is undefined error.

//npm package file with vars

:root { --default-font: Verdana; }

Tryina import this file with postcss-import plugin

@import('@username/themes')

It works, no errors about import or something

Tryina use the vars inside a css selector

.className { font-family: var(--default-font); }

Getting  default-font is undefined

pavelozavr commented 6 years ago

I should mention that the plugin works perfectly with the relative paths and vars inside the same file and dir. But always crashes if try to import from node_modules