gladkih / postcss-units

MIT License
12 stars 3 forks source link

request for vw unit #4

Open hbnr opened 7 years ago

hbnr commented 7 years ago

I'm kind a new to the postcss scene, and found that your plugin does something similar to what I've been doing in sass with my own functions. I was wondering if you would be interested to support vw-units as well.

Say I made a design based on a screen width of 1280px. And I have a div block that should have a width of 400px, but also scale while the browser is resizing. I would like to declare the width as follow.

div { width: vw(400); }

In sass I would register the following function to make it work

$designed-for-browser-width: 1280;
@function vw($px) {
    @return $px / $designed-for-browser-width * 100vw;
}
gladkih commented 7 years ago

ok, I'll think about it