Silently breaks on @mixin and @function blocks which has 3 or more parameters with default value
See original GitHub issueTry to @import
a file, which contains a @function
or @mixin
which has more than three parameters with a default value:
@function test($attr1, $attr2, $attr3: null, $attr4: null, $attr5: null) {
@return 'hello';
}
The extractor will halt and you will have to terminate the batch job manually.
Strange, but it doesn’t halt on eg. @function test($attr1, $attr2, $attr3, $attr4, $attr5)
, so it’s not the @function˛
or @mixin
block itself, which causes the error. It’s also OK with @function test($attr1, $attr2, $attr3, $attr4: null, $attr5: null) {
, so when there’s only two (or less) attributes with default a value.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Simplifying SASS Mixins with Default Values | by Seth Poulin
SASS mixins are blocks of code we can bundle into packages that get unpacked when we call them with the @include function.
Read more >Making a Sass mixin with optional arguments - Stack Overflow
Show activity on this post. You can put the property with null as a default value and if you don't pass the parameter...
Read more >Default values for mixins | Sass in the Real World: book 1 of 4
Set default values for mixins. When using mixins that require arguments, it is a best practice to always specify a default value for...
Read more >How to Use Mixins in Sass and Pass Arguments – With Code ...
To put it simply, a mixin is a code block which allows you to write your styles in it and use it throughout...
Read more >dart-sass/CHANGELOG.md at main - GitHub
Potentially breaking bug fix: Various functions in sass:math no longer treat floating-point numbers that are very close (but not identical) to integers as ......
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
@adamgruber @bencergazda there is a new release 1.0.0 as of today that is using AST instead of regex to parse the source files. This should get rid of all of these parsing errors. Try it out and see if you still experience any issues.
@adamgruber thank you for additional details. The regex becomes pretty complex and is prone to issues like this since source files can have so many different variations. I am hoping to have a version that uses AST in the next week or 2, though I am a bit short on time at the moment.
I will spend a couple of hours probably tomorrow and see if there’s a quick regex fix until then.