MCPcopy Create free account
hub / github.com/bigcommerce/stencil-cli / transform

Method transform

lib/nodeSass/BaseRulesFixer.js:11–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9 }
10
11 transform() {
12 const self = this;
13 return {
14 postcssPlugin: 'Transform Base Rules Issues into Comments',
15 Rule(rule, { Comment }) {
16 if (
17 rule.parent.type === 'root' &&
18 (rule.selector.startsWith('&') ||
19 rule.selector.startsWith(':not(&)') ||
20 rule.selector.startsWith('* &'))
21 ) {
22 const comment = new Comment({ text: self.replaceInnerComments(rule) });
23 rule.replaceWith(comment);
24 }
25 },
26 };
27 }
28
29 // when we replace rule with comment, there might be a case when comment is inside another rule
30 // which breaks the commenting root rule

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected