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.

Silently breaks on @mixin and @function blocks which has 3 or more parameters with default value

See original GitHub issue

Try 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:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jgranstromcommented, Sep 10, 2017

@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.

1reaction
jgranstromcommented, Aug 28, 2017

@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.

Read more comments on GitHub >

github_iconTop 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 >

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