Node-sass: CSS variables aren't properly compiled

Created on 3 Apr 2017  Â·  10Comments  Â·  Source: sass/node-sass

I have set up the latest version of node-sass compiler (4.5.2 at the moment). Everything in scss is compiled perfectly except for CSS variables. Accordingly to this: https://github.com/sass/libsass/issues/2076 variables compilation should already be in there if SASS 3.5 is used. Am I missing something to make variables compiled correctly?

Most helpful comment

Well, I'm using webpack and css variable like:

:root {
  --primary: $primary
}

$primary is not replaced with its value in v4.8.x
It works in v4.7.x

All 10 comments

Please provide an example

On 4 Apr. 2017 12:16 am, "Takhir" notifications@github.com wrote:

I have set up the latest version of node-sass compiler (4.5.2 at the
moment). Everything in scss is compiled perfectly except for CSS variables.
Accordingly to this: sass/libsass#2076
https://github.com/sass/libsass/issues/2076 variables compilation
should already be in there if SASS 3.5 is used. Am I missing something to
make variables compiled correctly?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1943, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWLHL1WR7ABT0X03GIN2imiWs-CpBks5rsP8pgaJpZM4MxmXd
.

For instance, I would like this:

 #datatable {            
            --paper-datatable-column-header: { 
                 font-size: 16px;                 
                 color: #34495e; 
                 background-color: #fbfbfb;                       
            }
}

to be compiled correctly. By default, after SASS compilation it's transformed into:

 #datatable {            
            --paper-datatable-column-header-font-size: 16px; 
            --paper-datatable-column-header-color: ... etc
}

which, apparently, doesn't work.

@TakhirMamirov the issue in libsass you've linked to hasn't been implemented yet. This would need to be implemented there and then have the libsass version of node-sass updated for this to be supported.

The libsass issue reported by @xzyfer has been updated

Fixed in 4.8.0

Well, I'm using webpack and css variable like:

:root {
  --primary: $primary
}

$primary is not replaced with its value in v4.8.x
It works in v4.7.x

Please search the identical closed issues.

On Sun., 8 Apr. 2018, 10:43 am frlinw, notifications@github.com wrote:

Well, I'm using webpack and css variable like:

:root {
--primary: $primary
}

$primary is not replaced with its value in v4.8.x
It works in v4.7.x

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/sass/node-sass/issues/1943#issuecomment-379509705,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWPu9M26mVuwmKpt9U6h1XZ2_qZamks5tmV0pgaJpZM4MxmXd
.

We ran into this problem as well, with gulp-sass, and after a long time of trying to fix the problem, and maybe a bit of yelling, we ended up force installing version 4.7.2 on the solution, which solved the problem.

Hope this can help some of you that run into the same problem with node-sass 4.8.x, try installing node-sass 4.7.x

This is not an issue, it's the correct functionality. Older versions of node-sass will be deprecated. We highly recommend fixing your bugs.

:root {
  --foo: #{$bar};
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mkbctrl picture mkbctrl  Â·  4Comments

primiano picture primiano  Â·  3Comments

goseesomething picture goseesomething  Â·  3Comments

alexandrubau picture alexandrubau  Â·  3Comments

cjo2118 picture cjo2118  Â·  3Comments