Skip to content

Instantly share code, notes, and snippets.

@dingyi
Forked from drublic/rem-fallback.less
Created January 4, 2013 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingyi/4449211 to your computer and use it in GitHub Desktop.
Save dingyi/4449211 to your computer and use it in GitHub Desktop.
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}
.some-class {
.x-rem(font-size, 1.4);
}
$main-font-size: 16px;
@mixin x-rem ($property, $value) {
#{$property}: $value * $main-font-size;
#{$property}: #{$value}rem;
}
.some-class {
@include x-rem(font-size, 1.4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment