Does not work with Sass interpolation
See original GitHub issueThis plugin does not seem to support Sass interpolation.
input.scss:
/** @define ComponentName */
.ComponentName {
$ComponentName: &;
&--modifierName {
color: blue;
#{$ComponentName} { // <- Sass interpolation
&-decendantName {
color: red;
}
}
}
}
postcss-bem-linter result:
input.scss
9:7 ✖ Invalid component selector plugin/selector-bem-pattern
".ComponentName--modifierName
#{$ComponentName}-decendantName"
output.css
/** @define ComponentName */
.ComponentName--modifierName {
color: blue;
}
.ComponentName--modifierName .ComponentName-decendantName {
color: red;
}
postcss-bem-linter result:
No errors
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
Interpolation - Sass
It's almost always a bad idea to use interpolation with numbers. Interpolation returns unquoted strings that can't be used for any further math,...
Read more >Sass interpolation doesn't work - Stack Overflow
1 Answer 1 ... The error message tells you that the background property needs to be wrapped by one of the named options....
Read more >All You Ever Need to Know About Sass Interpolation
Interpolation, often referred to as variable interpolation or variable substitution is not something unique to Sass. Actually, you can find ...
Read more >SASS | Interpolation - GeeksforGeeks
Interpolation allows us to interpolate sass expressions into a simple SASS or CSS code. Means, you can define ( some part or the...
Read more >SASS Interpolation - Using #{} - Studytonight
SASS Interpolation is a technique to include the result of any SASS Script expression into the stylesheet wherever required using #{} . This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A good question and I think it would be outside of the scope of this plugin to compile the Sass and understand how to apply the linting rules to the source file.
The solution I’d be tempted to go with would be to apply the
postcss-bem-linter
after the Sass transformation has happened. You will get less accurate line numbers in the error console (and no editor support on the source files) but that feels like an acceptable tradeoff for these complex Sass examples.We support nesting but mainly because that isn’t unique to Sass and also exists as an official proposal
@guilhermetod if i use json format, how can i do it? or you can show your js file?