Skip to content

Commit b144555

Browse files
committed
Add setVariables() example
1 parent 90e9017 commit b144555

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ $scss->addImportPath(function($path) {
8383
echo $scss->compile('{% raw %}@{% endraw %}import "vanilla.css";');
8484
{% endhighlight %}
8585

86+
### Preset Variables
87+
88+
You can set variables before compilation by using the `setVariables($vars)`
89+
method. To override a variable already defined in your scss source, use
90+
the `!default` flag.
91+
92+
{% highlight php startinline=true %}
93+
use Leafo\ScssPhp\Compiler;
94+
-
95+
$scss = new Compiler();
96+
$scss->setVariables(array(
97+
'var' => 'false',
98+
));
99+
100+
echo $scss->compile('$var: true !default;');
101+
{% endhighlight %}
102+
86103
### Output Formatting
87104

88105
It's possible to customize the formatting of the output CSS by changing the

0 commit comments

Comments
 (0)