Skip to content

Instantly share code, notes, and snippets.

@floz
Created April 29, 2014 15:26
Show Gist options
  • Save floz/11403630 to your computer and use it in GitHub Desktop.
Save floz/11403630 to your computer and use it in GitHub Desktop.
Mobiles mixins for stylus
baseImg = "../img/"
img( url )
background transparent url( baseImg + url ) no-repeat
imgImportant( url )
background transparent url( baseImg + url ) !important
imgRepeat( url )
background transparent url( baseImg + url )
portrait()
@media( orientation: portrait )
{block}
landscape()
@media( orientation: landscape )
{block}
cimg( path, name, w, h )
img( "common/" + path + "1x/" + name )
width w
height h
@media (-webkit-device-pixel-ratio: 2)
img( "common/" + path + "2x/" + name )
background-size w h
pimg( path, name, w, h )
@media (orientation: portrait)
img( "portrait/" + path + "1x/" + name )
width w
height h
@media (orientation: portrait) and (-webkit-device-pixel-ratio: 2)
img( "portrait/" + path + "2x/" + name )
background-size w h
limg( path, name, w, h )
@media (orientation: landscape)
img( "landscape/" + path + "1x/" + name )
width w
height h
@media (orientation: landscape) and (-webkit-device-pixel-ratio: 2)
img( "landscape/" + path + "2x/" + name )
background-size w h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment