Skip to content

Feat/add comment exclusions#20

Open
mihaisavezi wants to merge 2 commits intoMadLittleMods:masterfrom
mihaisavezi:feat/add-comment-exclusions
Open

Feat/add comment exclusions#20
mihaisavezi wants to merge 2 commits intoMadLittleMods:masterfrom
mihaisavezi:feat/add-comment-exclusions

Conversation

@mihaisavezi
Copy link

@mihaisavezi mihaisavezi commented Apr 25, 2020

First stab at handling comments exclusions, see #17

@mihaisavezi
Copy link
Author

stab at #17

const commentStart = 'no important-start';
const commentEnd = 'no important-end';

if(node.text === commentStart) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to worry about comparing whitespace here? Perhaps we need to node.text.trim()?

Comment on lines +63 to +64
const commentStart = 'no important-start';
const commentEnd = 'no important-end';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to

Suggested change
const commentStart = 'no important-start';
const commentEnd = 'no important-end';
const enableComment = 'postcss-increase-specificity enable';
const disableComment = 'postcss-increase-specificity disable';

// Avoid adding additional selectors (stackableRoot) to descendant rules of @keyframe {}
// i.e. `from`, `to`, or `{number}%`
var isInsideKeyframes = rule.parent.type === 'atrule' && rule.parent.name === 'keyframes';
let isExcluded = false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let isExcluded = false;
let isDisabled = false;

});

it('should handle exclusion commments', function () {
return testPlugin('./test/fixtures/comments-to-exclude.css', './test/fixtures/comments-to-exclude.expected.css');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disable-enable-with-comments.css

@@ -55,14 +55,33 @@ module.exports = postcss.plugin('postcss-increase-specificity', function(options
var opts = objectAssign({}, defaults, options);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay @mihaisavezi 🙇

This looks like a great v1 we can merge of this feature 👍

My comments are mainly framing everything in terms of disable/enable instead of exclude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants