postcss / postcss-custom-properties

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

propertiesDir/propertiesFile option #41

Closed dan-gamble closed 8 years ago

dan-gamble commented 8 years ago

Would it be possible to add an option like postcss-mixins mixinsDir?

My use case is:

property-definitions.css

--Font_Size-base: 16px;
--Line_Height-base: calc(var(--Font_Size-base) + 10px);

If i was to use the variables option i wouldn't be able to use calc() to create certain properties :)

MoOx commented 8 years ago

Sorry, I am not following what you want. What is your issue?

dan-gamble commented 8 years ago

Basically you can supply a directory in postcss-mixins then it will read them files and make the mixins available on the global scope.

Just wondering if something of the equivalent could be added to this so i could use the variables without having to implicitly import the file

MoOx commented 8 years ago

Implicit is a bad thing imo. Confuse newbies. And it's definitely not in the scope of this plugin I think, which try to follow the spec, even if it have to impose restriction (like for :root) Why don't you use "variables" option instead?

dan-gamble commented 8 years ago

I would use the variables options but currently some of my variables are built based on other variables:

--Font_Size-base: 16px;
--Line_Height-base: calc(var(--Font_Size-base) + 10px);

As far as i know i wouldn't be able to do this with the variables option

MoOx commented 8 years ago

If you define this in JS (via "variables" option), you can do whatever you want, without the "pain" of CSS syntax.

dan-gamble commented 8 years ago

That could work, might make it a bit more messier than i'd like but that would work, thanks :)