Skip to content

Instantly share code, notes, and snippets.

@sergej-brazdeikis
Created July 21, 2012 11:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergej-brazdeikis/3155586 to your computer and use it in GitHub Desktop.
Save sergej-brazdeikis/3155586 to your computer and use it in GitHub Desktop.
Less.js function which generates all prefixes for given CSS property
/* Less.js function which generates prefixes any CSS property */
.pf(@prop, @value){
-:~`";"+"@{prop}:@{value};-webkit-@{prop}:@{value};-moz-@{prop}:@{value};-o-@{prop}:@{value};-ms-@{prop}:@{value}".replace(/'/g,"")`;
}
#container {
.pf('border-radius', 10px);
.pf('transform', 'rotate(7deg)');
.pf('transition','all 1s ease-in-out');
.pf('box-shadow','2px 2px 5px 0 rgba(0,0,0,.6)');
.pf('flex', 1);
}
/*
* Example CSS Output:
*
* #container {
* -: ;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-o-border-radius:10px;-ms-border-radius:10px;
* -: ;transform:rotate(7deg);-webkit-transform:rotate(7deg);-moz-transform:rotate(7deg);-o-transform:rotate(7deg);-ms-transform:rotate(7deg);
* }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment