omega omega - 3 months ago 25
Sass (Sass) Question

How to format text with variable without quotes in SASS?

In SASS, I have this

@mixin background_gradient($dir, $from, $to) {
background: linear-gradient('to #{$dir}', $from, $to); // for IE10

Except in the browser in comes out to

browser: linear-gradient("to top", #ffffff, #ffffff)

but it needs to be

browser: linear-gradient(to top, #ffffff, #ffffff)

without the quotes.

How can I do this?


Answer Source

If need to remove quotes from a string, you can use the unquote function:

@mixin background_gradient($dir, $from, $to) {
    background: linear-gradient(unquote('to #{$dir}'), $from, $to);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download