MadLittleMods / postcss-increase-specificity

Why? Dealing with CSS you can't remove(mainly from a 3rd party). Increases specificity of selectors.
MIT License
50 stars 16 forks source link

Add functionality to ignore part of a file (inline comments) #17

Open track0x1 opened 6 years ago

track0x1 commented 6 years ago

Potentially using something like

/* postcss-increase-specificity disable-line */ or /* postcss-increase-specificity disable */ /* postcss-increase-specificity enable */

MadLittleMods commented 6 years ago

:+1: We should mimic what eslint does, https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments. PR welcome!

// eslint-disable
// eslint-enable
// eslint-disable-line
// eslint-disable-next-line

Btw, there is https://github.com/MadLittleMods/postcss-increase-specificity/pull/16 but it is stale and I prefer this inline comment solution

evenfrost commented 6 years ago

Looking for this as well. @MadLittleMods your plugin is really gold as it helps to gradually transfer our huge client from the legacy stuff (Angular/Grunt) to the modern one (Vue/webpack). The only thing I'm really looking forward to is the possibility to ignore specific parts of CSS processed with postcss-increase-specificity. For example, we have a PostCSS file which contains some global tweaks to merge old styles with new styles, and specificity should not be added here. And postcss-plugin-context is not an option here as well because it would be an overkill to add @context in each Vue file. So ignore comments are the best option here. Thanks!

mihaisavezi commented 4 years ago

Any updates ?

MadLittleMods commented 4 years ago

@mihaisavezi No update. This issue is the best place to track but you could also check out the changelog: https://github.com/MadLittleMods/postcss-increase-specificity/blob/master/CHANGELOG.md

mihaisavezi commented 4 years ago

No worries managed to find a fix for my case. Doesn't apply to evenfrosts case. I use postcss-use to apply the plugin to only a specific part of the stylesheets.

To ignore part of the stylesheets with a comment you can try looking at postcss-safeimportant they support this, for a sample implementation

strarsis commented 3 years ago

IMHO such a thing should be added to PostCSS itself.