7

I am trying to handpick the parts of a certain theme/plugin we want to use in our site by tinkering with the source SCSS files. The theme in question is Vali Admin.

I haven't used SASS or LESS in ages. Not familiar with compiling them at all. I just installed ruby and the compass (through gem install) in my system, and ran compass compile on the root directory of the vendor theme. However I am getting the following error:

error sass/main.scss (Line 4 of sass/1-tools/bootstrap-source/_root.scss: Invalid CSS after "...lor}: #{$value}": expected "{", was ";")

I am also getting a couple of warnings about "interpolation near operators". I'll paste it here if needed.

I have no idea why I am getting that error. I haven't made any changes to the SCSS files yet, I am simply trying to compile the vendor source code.

Here is the SCSS:

:root {
  // Custom variable values only support SassScript inside `#{}`.
  @each $color, $value in $colors {
    --#{$color}: #{$value};
  }

  @each $color, $value in $theme-colors {
    --#{$color}: #{$value};
  }

  @each $bp, $value in $grid-breakpoints {
    --breakpoint-#{$bp}: #{$value};
  }

  // Use `inspect` for lists so that quoted items keep the quotes.
  // See https://github.com/sass/sass/issues/2383#issuecomment-336349172
  --font-family-sans-serif: #{inspect($font-family-sans-serif)};
  --font-family-monospace: #{inspect($font-family-monospace)};
}
dabadaba
  • 9,064
  • 21
  • 85
  • 155

5 Answers5

4

Just delete of the double "-" in the following lines:

old: --#{$color}:
new: -#{$color}:

this works fine.

Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
SASSNErd
  • 41
  • 2
0

I was getting this same error for Bootstrap 4.3 (https://getbootstrap.com/docs/4.3) in the _root.scss file.

I'm using CodeKit to compile Scss and it was pretty out of date. I realised that it didn't like to compile --#{$varname where -- and # live next to each other without a string in between. Whereas this line worked fine: --breakpoint-#{$bp}: #{$value};

My solution:

Updating CodeKit fixed the issue so I imagine you're not using the latest version of Compass?

Must Impress
  • 339
  • 2
  • 4
0

Don't make any changes in the code. Just upgrade the version of sass gem that you are using. You can install the latest version using gem install sass.

I had version 3.4.25 and it was giving me the exact same error. I installed version 3.7.4 and everything is fine.

Check here for more information - https://github.com/sass/sass/issues/2383#issuecomment-399755755

Faisal Feroz
  • 12,458
  • 4
  • 40
  • 51
0

change to

--#{''+$color+''}: #{$value};

and worked :)

0

My solution was to wrap the '--' into a sass variable:

#{'--'}#{$color}: #{$value};
z1090
  • 1
  • 1