Skip to content

Instantly share code, notes, and snippets.

@slavapas
Forked from gearmobile/Stylus PX to REM Mixin
Created January 5, 2017 07:55
Show Gist options
  • Save slavapas/421bf7475e72bf445f83f81a341f475e to your computer and use it in GitHub Desktop.
Save slavapas/421bf7475e72bf445f83f81a341f475e to your computer and use it in GitHub Desktop.
Stylus PX to REM Mixin
set-font-size(value) {
font-size: value; /* добавляем PX как подстраховку */
if (value is inherit) {
/* делаем если нет значения для шрифта */
} else {
font-size: remify(value);
}
}
remify(value) {
u = unit(value);
if (u is 'px') {
return unit(value/16, 'rem');
} else {
return unit(value, u);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment