nick.skriabin
nick.skriabin

Reputation: 873

SCSS custom function and String extra quotes

I've stacked with custom functions in SCSS/SASS. There's code of custom function:

require 'sass'

module Sass::Script::Functions
  def s3_path(path)
    assert_type path, :String
    image_url("#{APP_CONFIG[:system][:s3_host]}/#{path.gsub(/^([\/]+)/, '')}".gsub(/(["]+)/, ''))
  end

  declare :reverse, :args => [:string]
end

There'se call in css:

ul li a span{
    background: s3_path('email_new/menu.png') no-repeat;
}

And there's output

.menu ul li a span {
    background: url('https://***DOMAIN***/"email_new/menu.png"') no-repeat;
}

But expected variant is

.menu ul li a span {
    background: url('https://***DOMAIN***/email_new/menu.png') no-repeat;
}

You can see extra quotes in the compiled css. So i've tried to gsub it with no luck. Why does scss adds these quotes to a string? And how to remove them? Thanks in advance.

Upvotes: 2

Views: 1267

Answers (1)

Jérémie Parker
Jérémie Parker

Reputation: 3174

Have you tried unquote SASS method ?

Upvotes: 1

Related Questions