andreyfedoseev / django-static-precompiler

Django Static Precompiler provides template tags and filters to compile CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and Handlebars. It works with both inline code and external files.
Other
222 stars 60 forks source link

SCSS variables fail to emit inside CSS calc #140

Closed b9chris closed 1 year ago

b9chris commented 3 years ago
body {
  $test: 10px;
  left: calc(100% - $test);
}

Should emit:

body {
  left: calc(100% - 10px);
}

Instead emits:

body {
  left: calc(100% - $test);
}
andreyfedoseev commented 2 years ago

@b9chris

Can you confirm that your snippet works correctly if you compile with with SCSS, without using django-static-precompiler?

Also, what is calc() exactly? My guess is that SCSS doesn't recognize this function and doesn't apply variable substitution.

It tried it with the following snippet and it worked:

body {
  $test: 10px;
  left: 100px - $test;
}

The output is:

body {
  left: 90px;
}