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.

Stop remove empty selectors

See original GitHub issue

Sass will remove empty selectors by default, Is there an options to disable this?

Such as

.empty {
}

will compile to nothing, but I want it compile to .empty{}, otherwise I got error when using css-modules.

ref: https://github.com/sass/node-sass/issues/1569 https://github.com/css-modules/css-modules/issues/140

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

6reactions
mgretercommented, Jun 2, 2016

Can be done with important comments

.empty {
    /*! keep */
}
1reaction
chriseppsteincommented, Jun 2, 2016

What @mgreter said. Although, a random weird comment isn’t very self documenting so maybe wrap it up in a mixin:

@mixin empty-module($module-name) {
  .#{$module-name} { /*!*/ }
}
@include empty-module("empty");
Read more comments on GitHub >

github_iconTop Results From Across the Web

empty - CSS: Cascading Style Sheets - MDN Web Docs
The :empty CSS pseudo-class represents any element that has no children. Children can be either element nodes or text (including whitespace) ...
Read more >
empty - CSS-Tricks
The CSS :empty pseudo-class selects any element that does not contain children for a given selector.
Read more >
CSS :empty Selector | SamanthaMing.com
No problem, you got CSS :empty selector... ... Easy, you can use the :empty selector ... Here's another example using :empty to hide...
Read more >
CSS :empty Selector - W3Schools
The :empty selector matches every element that has no children (including text nodes). Version: CSS3. Browser Support. The numbers in the table specifies...
Read more >
not(:empty) CSS selector is not working? - Stack Overflow
If I remove the :not(:empty) part, it works just fine. Even if I change the selector to input:not(:empty) it still won't select input...
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