syntax - Can I use arguments within the function definition? -


i wonder if following syntax correct sass:

@function foo($param) {     @return $param; } @mixin bar($paramone, $paramtwo: foo($paramone)) {     test: $paramtwo; } #test { @include bar(foobar); } 

with expected return:

#test { test: foobar; } 

doesn't seems work (as $paramone looses it's value) when using following phpsass compiler sass/scss.

this correct syntax? or i'm missing something?

it's similar how it's in _vertical_rhythm.scss:

@mixin adjust-font-size-to($to-size, $lines: lines-for-font-size($to-size), $from-size: $base-font-size) { 

it seems kind of syntax valid cimmanon posted on sassmeister gist (thanks) using ruby version of parser. other parsers have problem (phpsass in case) depending how implemented logic.

in case of issues, make sure you're using right parser scss syntax, not sass syntax (wiki, e.g. new sassparser(['syntax' => 'scss'])). see: what's difference between scss , sass?


note same syntax used in compass (open-source css authoring framework) vertical rhythm as:

@mixin adjust-font-size-to($to-size, $lines: lines-for-font-size($to-size), $from-size: $base-font-size) 

but in recent version it's just:

@mixin adjust-font-size-to($to-size, $lines: auto, $from-size: $base-font-size) 

Comments

Popular posts from this blog

c - CUDA code not processing if block properly -

oracle11g - get root domain from url Oracle sql regex_substr -

xcode - Swift Playground - Files are not readable -