Skip to content

Instantly share code, notes, and snippets.

@skill83
Last active April 19, 2016 09:45
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 skill83/7527075 to your computer and use it in GitHub Desktop.
Save skill83/7527075 to your computer and use it in GitHub Desktop.
less size mixin
//less mixin
.size(@string) {
@w: ~`(function(a){ return a.split(" x ").shift()+"px"; })( @{string})`;
@h: ~`(function(a){ return a.split(" x ").pop()+"px"; })( @{string})`;
width:@w;
height:@h;
}
//usage
#myId{
.size("225 x 305");
}
//result
#myId{
width:225px;
height:305px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment