sass / sass

Sass makes CSS fun!

Home Page:https://sass-lang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for defining units of measure

LuisMeirelles opened this issue · comments

We usually end up adopting some measure standards as we develop, like a spacing unit = 8px, or the width of a col (in a grid-based layout like bootstrap) to multiply and get a consistent spacing.

I think it makes sense to have a way to define these units, something like

@unit m: 8px;

So I can express "two units of margin measure" like this

.selector {
    margin: 2m;
}

This case is very simple and could easily be replaced by multiplying the value by the chosen unit, but adding a specific notation for this brings ore readability and flexibility, as we could carry out more complex calculations in an uncomplicated and standardized way.

This is the sort of thing that really belongs in core CSS if anywhere. We try pretty hard to avoid adding more custom syntax that might overlap with future CSS features.