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.

Designate a mixin as !important

See original GitHub issue

When calling a mixin (parametric or otherwise), if the call ends in !important, it would be splendid if this !important flowed down to all the mixin declarations.

So:

.bordered {
    border-top: dotted 1px black;
    border-bottom: solid 2px black;
}

#menu a {
    color: #111;
    .bordered !important;
}

Would generate:

#menu a {
    color: #111;
    border-top: dotted 1px black !important;
    border-bottom: solid 2px black !important;
}

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
matthew-deancommented, Jan 5, 2012

Just to continue the conversation from Issue #100, I would say that specially designating a keyword as having a different mixin behavior is arbitrary and probably not ideal. With using variables, you can append any keyword value as you like into your mixin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding `!important` to a mixin - css - Stack Overflow
important to a mixin. I tried both the following ways, and they return an error: @include linear-gradient(hsl(68%, 94%, 90%), hsl(68%, 90%, 80% ...
Read more >
mixin and @include - Sass
If a mixin passes arguments to its content block, that content block must declare that it accepts those arguments. This means that it's...
Read more >
Sass @mixin and @include - W3Schools
The @include directive is used to include a mixin. Sass @include mixin Syntax: selector { @include mixin-name; }. So, to include the important- ......
Read more >
How to Use Mixins in Sass and Pass Arguments – With Code ...
First we define a mixin using the @mixin at-rule. Then we give it a name – choose whatever you think will fit what...
Read more >
Sass Mixins: Keep Your Stylesheets DRY - Toptal
@mixin theme($name, $color) { // Define colors in your theme $primary: $color; ... The main reason I use this is because I will...
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