Calling SCSS Functions from Ruby

I am trying to call darken from Ruby.

Here is my code:

Sass::Script::Functions.darken('#FF0000', '20%') 

I keep getting this error:

 undefined method `darken' for Sass::Script::Functions:Module 

What am I doing wrong?

0
source share
1 answer

Sass::Script::Functions is a module with instance methods that must be included in another object. Unfortunately, when you do this, he needs other working methods. There is an EvaluationContext object, and an extension that launches darken to run, but fails when it approves the types of objects to be transmitted.

 class C < Sass::Script::Functions::EvaluationContext def initialize super :global end def x darken('#FF0000', '20%') end end > C.new.x ArgumentError: $color: "#FF0000" is not a color 

What are you trying to achieve? It does not seem that Sass should be called in this way.

0
source

All Articles