Skip to content

Instantly share code, notes, and snippets.

@sapegin
Created February 4, 2012 06:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sapegin/1735915 to your computer and use it in GitHub Desktop.
Save sapegin/1735915 to your computer and use it in GitHub Desktop.
CSS vendor prefixes for Stylus
// © 2011 Artem Sapegin http://sapegin.ru
// Simple CSS3 properties with vendor prefixes
box-sizing()
-moz-box-sizing arguments
box-sizing arguments
box-shadow()
-webkit-box-shadow arguments
box-shadow arguments
transition()
-webkit-transition arguments
-moz-transition arguments
-ms-transition arguments
-o-transition arguments
transition arguments
transform()
-webkit-transform arguments
-moz-transform arguments
-ms-transform arguments
-o-transform arguments
transform arguments
overflow-scrolling()
-webkit-overflow-scrolling arguments
overflow-scrolling arguments
// Preserve '%'s in hsla() -- strange hack
hsla()
'hsla(%s)' % unquote(join(', ', arguments))
// Gradients
// https://github.com/LearnBoost/stylus/issues/245
replace(str, a, b)
str = clone(str)
for e, i in str
if length(e) > 1
str[i] = replace(e, a, b)
else
if a == e
str[i] = b
str
linear-gradient()
prop = current-property[0]
val = current-property[1]
args = unquote(join(', ', arguments))
add-property(prop, replace(val, '__CALL__', '-webkit-linear-gradient(%s)' % args))
add-property(prop, replace(val, '__CALL__', '-moz-linear-gradient(%s)' % args))
add-property(prop, replace(val, '__CALL__', '-ms-linear-gradient(%s)' % args))
add-property(prop, replace(val, '__CALL__', '-o-linear-gradient(%s)' % args))
g = 'linear-gradient(%s)' % args
g
@Grawl
Copy link

Grawl commented Feb 4, 2012

а если попробовать дублированием последней примеси и заменой в ней “linear” на “radial” добавить поддержку круговых растяжек? надо проверить. сейчас фильм досмотрю и попробую.

@Grawl
Copy link

Grawl commented Feb 4, 2012

получилось! вот: gist.github.com/1736384 (эта же ссылка сверху справа, форк же)
добавил много чего. надеюсь, не только для Себя старался.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment