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.

Idea is to define a block which will be used in particular selector if rule is true. And all other properties in whole selector should be skipped. As a simple example: main.scss

body {
    background: #000;
    @only $forIE8 {
        background: #FFF;
    }
    @only $forIE9 {
        background: #CCC;
    }
}

ie8.scss

$forIE8: true;
@import "main";

ie9.scss

$forIE9: true;
@import "main";

all.scss

$forIE8: false;
@import "main";

Output: ie8.css

body {
  background: #FFF;
}

ie9.css

body {
  background: #CCC;
}

all.css

body {
  background: #000;
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
wheeylscommented, Aug 3, 2019

FWIW, I thought this directive would be helpful as well. I’ve written a postcss plugin based on this syntax here: https://github.com/wheeyls/postcss-only-directive.

0reactions
nex3commented, Mar 25, 2014

@if and @else are sufficient for this use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Numbers Only Directive - StackBlitz
Dependencies · 1 · 2 · 3 · 4 · 5 · 6 · 7 · 8.
Read more >
Digit Only Directive in Angular - codeburst
Digit Only Directive in Angular. Natural numbers are frequently used as Account Numbers, Transaction IDs, Job Codes, etc.
Read more >
Angular DigitOnly Directive and Mask Directive - GitHub
An Angular directive only allows [0-9] in the input box when typing, pasting or drag/dropping. This directive handles both Windows keyboard and Mac...
Read more >
READ-ONLY directive - Micro Focus
The READ-ONLY directive allows you to make some fields (columns) of data read-only, while preserving normal access to other fields/columns.
Read more >
ngx-numbers-only-directive - npm
An angular directive for input element that allows only numeric values. Latest version: 1.0.2, last published: 2 years ago.
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