question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

String interpolation in @each

See original GitHub issue

When trying to use Sass’s @each directive with string interpolation of the loop variables I get an unknown word error.

The following example code:

$sizes: (
  "small": 12px, 
  "large": 14px
);

@each $name, $size in $sizes {
  .#{$name} {
    font-size: $size;
  }
}

results in the following build error:

Module build failed: Unknown word (75:6)

  73 |
  74 | @each $name, $size in $sizes {
> 75 |   .#{$name} {
     |      ^

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, May 5, 2017

@BHouwens use right syntax for webpack 2

use: [
       {
           loader: 'css-loader',
           options: { modules: true, importLoaders: 1, localIdentName: "[name]__[local]___[hash:base64:5]" }
       },
       'postcss-loader',
       {
              loader: 'sass-loader',
       }
 ]
1reaction
Andrey7287commented, Apr 5, 2017

Try without quotes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

string interpolation - format string output - Microsoft Learn
An interpolated string is a string literal that might contain interpolation expressions. When an interpolated string is resolved to a result ...
Read more >
String interpolation - Wikipedia
In computer programming, string interpolation is the process of evaluating a string literal containing one or more placeholders, yielding a result in which ......
Read more >
Java Program to Illustrate String Interpolation - GeeksforGeeks
String Interpolation is a process in which the placeholder characters are replaced with the variables (or strings in this case) which allow ...
Read more >
String Interpolation in Java | Baeldung
String interpolation is a straightforward and precise way to inject variable values into a string. It allows users to embed variable references ...
Read more >
Python String Interpolation - Programiz
Python 3.6 added new string interpolation method called literal string interpolation and introduced a new literal prefix f . This new way of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found