Created
March 4, 2013 10:45
-
-
Save mishoo/5081450 to your computer and use it in GitHub Desktop.
Extremely useful LESS/CSS utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.pf1(@prop, @value) { | |
we: ~`"suck; " + | |
" -webkit-@{prop}: @{value};" + | |
" -moz-@{prop}: @{value};" + | |
" -o-@{prop}: @{value};" + | |
" -ms-@{prop}: @{value};" + | |
" @{prop}: @{value}"`; | |
} | |
.pf2(@prop, @value) { | |
we: ~`"suck; " + | |
" @{prop}: -webkit-@{value};" + | |
" @{prop}: -moz-@{value};" + | |
" @{prop}: -o-@{value};" + | |
" @{prop}: -ms-@{value};" + | |
" @{prop}: @{value}"`; | |
} | |
// the "we: suck" hack is necessary to make LESS parse that insanity. | |
// usage: | |
div.flexible { | |
.pf2(display, flex); | |
.pf1(flex-direction, row); | |
.pf1(justify-content, center); | |
.pf1(align-content, center); | |
.pf1(align-items, stretch); | |
} | |
// originally found it here: http://sjevsejev.blogspot.ro/2012/07/lessjs-function-generates-prefixes-for.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment