csstools / postcss-advanced-variables

Use Sass-like variables, conditionals, and iterators in CSS
Creative Commons Zero v1.0 Universal
127 stars 33 forks source link

Correctly handle empty @content blocks in a @mixin #106

Open jesstelford opened 8 months ago

jesstelford commented 8 months ago

Including a mixin that uses a @content block without a block ({ }) after the mixin name causes an error:

TypeError: Cannot read properties of undefined (reading 'type')

Example:

@mixin test {
  display: block;
  @content;
}

@include test {
  width: 20px;
}
/* PASS:
display: block;
width: 20px;
*/

@include test { }
/* PASS:
display: block;
*/

@include test;
/* ERROR with: TypeError: Cannot read properties of undefined (reading 'type') */