Skip to content

Instantly share code, notes, and snippets.

@timschoch
Created February 18, 2016 15:21
Show Gist options
  • Save timschoch/70faad753cba2abd28a7 to your computer and use it in GitHub Desktop.
Save timschoch/70faad753cba2abd28a7 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// why does this need interpolation to work?
@function capitalize( $string ) {
@return '#{to-upper-case(str-slice($string, 1, 1))}' + str-slice($string, 2);
}
works {
bar: capitalize( foo );
bar: capitalize( 'bar' );
bar: capitalize( "baz" );
}
// because this fails...
@function capitalize( $string ) {
@return to-upper-case(str-slice($string, 1, 1)) + str-slice($string, 2);
}
fails {
bar: capitalize( foo );
bar: capitalize( 'bar' );
bar: capitalize( "baz" );
}
works {
bar: "Foo";
bar: "Bar";
bar: "Baz";
}
fails {
bar: Foo;
bar: "B"ar;
bar: "B"az;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment