madeleineostoja / rucksack

A little bag of CSS superpowers, built on PostCSS
https://www.rucksackcss.org
Other
1.85k stars 48 forks source link

Rucksack Variables #38

Closed DocWatson closed 8 years ago

DocWatson commented 8 years ago

Just a quick question here about variables. I see @alias being used as a short hand for property names, but can it be used to set property values too? E.G.

@alias {
    brand-blue: #00F;
}

p {
    color: brand-blue;
}

I can always use another tool but just curious if the above is possible and/or considered an okay practice?

madeleineostoja commented 8 years ago

It's not technically supported, but should work, since it loops over both properties and values (for things like transitions, where properties are used in the declaration value).

Though I'd recommend transpiling the future CSS custom vars spec with postcss-custom-properties for stuff like this.

DocWatson commented 8 years ago

Thanks for the response, Sean! Since this answers my question (and provides a recommendation), I am going to go ahead and close this out.