Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCSS - how to insert ruby variable? #733

Open
gapipro opened this issue Sep 14, 2016 · 6 comments
Open

SCSS - how to insert ruby variable? #733

gapipro opened this issue Sep 14, 2016 · 6 comments

Comments

@gapipro
Copy link

gapipro commented Sep 14, 2016

I am trying to inject ruby variable into sass but I can't find any help on how to do it.

If I use CSS engine then it can be done like so:

  css:
    .remodal-overlay:after {
      background-image: url(#{variables['palette-background-color']});
    }

But when I try to do same thing with SCSS I get error:

Invalid CSS after "...r : #{variables": expected "}", was "["palette-backg..."

And here is my scss:

  scss:

    $color : #{variables["palette-background-color"]};

    .remodal-overlay:after {
      background-image:$color;
    }

Should I set local variables in ruby before using them in scss?

@gapipro gapipro changed the title SASS - how to insert ruby variable? SCSS - how to insert ruby variable? Sep 15, 2016
@tetherit
Copy link

I'm trying to do the same and hitting the same "Invalid CSS after..." error. Would be great to have a solution without resorting to the CSS engine.

@chrisweconect
Copy link

@xanview @gapipro - any luck with this?

@minad
Copy link
Member

minad commented Feb 24, 2017

This is not supported because of the way sass code is compiled right now.

@chrisweconect
Copy link

chrisweconect commented Feb 24, 2017

@minad - so this type of stuff won't work anymore?

- if @network.titlebar_image
  scss:
    .navbar-default {
      background-image: url(#{@network.titlebar_image.url});
      background-size: contain;
      background-position: center center;
      background-repeat: no-repeat;
    }

thanks...

@averbs
Copy link

averbs commented Jul 30, 2017

Just hit this today. Would be awesome to support ruby variables in the sass or scss filters.

@elmirill
Copy link

Nothing happens here.
This one is still actual, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants