file1.scss
@function toPx($n) { @return $n + 0px; }
file2.scss
body { font-size:toPx(10); }
file3.scss
@import "file1.scss"; @import "file2.scss";
The output of file3.css contains
body { font-size:toPx(10); }
I cannot get my toPx function to work even if I import directly into file2.scss. If I declare toPx inside file2.scss, it will work.
I am new to SASS, therefore, believing that I am missing something simple here, can anyone tell me something?
Surprisingly Scout, the sass compiler I use does not throw an error, but simply outputs toPx (10) in the output CSS.
Edit
I found this link, which seems to suggest that I will need to use the Ruby API to achieve a global function. Can anyone clarify?
http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#adding_custom_functions
source share