
string(val)
  '' + val

replace(expr, str, val)
  expr[i] = val if string(e) == str for e, i in expr

linear-gradient(from, to) {
  if current-property {
    webkit = s('-webkit-gradient(linear, 0% 0%, 0% 100%, from(%s), to(%s))', from, to);
    moz = s('-moz-linear-gradient(%s, %s)', from, to);
    prop = current-property;
    replace(current-property[1], '__CALL__', moz);
    add-property(prop[0], prop[1]);
    webkit;
  } else {
    error('linear-gradient() must be used within a property');
  }
}

body
  background foo linear-gradient(#2a2a2a, #454545) bar

body
  background-image linear-gradient(#2a2a2a, #454545)

body
  foo linear-gradient(#333, #999)

mixin()
  foo linear-gradient(#eee, #999)

body
  mixin()

// multiple calls

something(val)
  if current-property
    add-property(current-property[0], s('-webkit-something(%s)', val))
    add-property(current-property[0], s('-moz-something(%s)', val))
    s('something(%s)', val)
  else
    error('something() must be used within a property')

body {
  foo: something(15px);
}

.test-as-mixin
  add-property(foo, bar)

display(val)
  if val == 'flex'
    display: vendorize(val)
  else
    display: val

vendorize(val)
  for vendor in vendors
    unless vendor == official
      add-property('display', '-%s-%s' % (vendor val))
  val

body
  display: flex
  @media all and (min-width: 768px)
    display: flex

@page
  display: flex

@font-face
  display: flex

@keyframes foo
  0%
    display: flex
  100%
    display: block

bar =
  display: flex

body
  {bar}

quz()
  @media print
    {block}

body
  +quz()
    display: block
    foo: something(4px)
