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.

Nested CSS @apply mixins are breaking when minified.

See original GitHub issue

I’ve run into a problem after CSS has been minified (through kangax/html-minifier which uses clean-css) where the last property being applied to a CSS mixin variable loses its semi-colon. If this property is another mixin, it breaks, particularly for IE11 and Edge. Could this please be fixed so that the semi-colons are preserved?

As a side note, I’ve found a way around this by adding another property, but it gets messy, so if this could be fixed, it would be greatly appreciated.

Input CSS

--my-mixin: {
    @apply --another-mixin;
};

Actual output CSS

--my-mixin:{@apply --another-mixin};

Expected output CSS

--my-mixin:{@apply --another-mixin;};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
jakubpawlowiczcommented, May 10, 2017

The fix is out in 3.4.26 and 4.1.2.

1reaction
Norman-Amycommented, May 10, 2017

I’m using it in Polymer web components. I believe Polymer provides a shim for browsers when it isn’t supported natively.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested mixins in LESS behaviour - Stack Overflow
When you call the mixin it overwrites the @parent variable for the current scope, which gets then inherited to nested rules, where you...
Read more >
{...} nested class as a mixin – unspecified behaviour #2453
But re-use of CSS rulesets as mixins, especially when it comes to nesting and complex selector hierarchies, is relatively indirect/supplementary ...
Read more >
Sass Techniques from the Trenches | CSS-Tricks
There are a couple of new ideas here. The mixin has a nested function called @content . So, in the .MyComponent class, we're...
Read more >
CSS with nested calc broken - WordPress.org
To do that, you have to go to “Settings” -> “Optimize CSS” -> “CSS Files Minification” and then below “Do not minify the...
Read more >
Sass Mixins vs Extends: The Data - Belly Card Engineering
For me, the choice between mixins and extends breaks down into three ... File size for both raw and minified CSS was smaller...
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