postcss-increase-specificity icon indicating copy to clipboard operation
postcss-increase-specificity copied to clipboard

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

Open track0x1 opened this issue 7 years ago • 6 comments

Potentially using something like

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

track0x1 avatar May 31 '18 16:05 track0x1

:+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

MadLittleMods avatar May 31 '18 17:05 MadLittleMods

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!

evenfrost avatar Jun 08 '18 16:06 evenfrost

Any updates ?

mihaisavezi avatar Apr 24 '20 12:04 mihaisavezi

@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

MadLittleMods avatar Apr 24 '20 21:04 MadLittleMods

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

mihaisavezi avatar Apr 25 '20 06:04 mihaisavezi

IMHO such a thing should be added to PostCSS itself.

strarsis avatar Mar 14 '21 13:03 strarsis