Skip to content

Commit 058f8a4

Browse files
committedAug 19, 2021
Revert breaking change
1 parent 7e318a7 commit 058f8a4

File tree

2 files changed

+25
-26
lines changed

2 files changed

+25
-26
lines changed
 

‎index.js

+17-18
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@ module.exports = function postcssPrefixSelector(options) {
66
? [].concat(options.includeFiles)
77
: [];
88

9-
return {
10-
postcssPlugin: 'postcss-prefix-selector',
11-
Rule(rule) {
12-
if (
13-
ignoreFiles.length &&
14-
rule.source.input.file &&
15-
isFileInArray(rule.source.input.file, ignoreFiles)
16-
) {
17-
return;
18-
}
19-
if (
20-
includeFiles.length &&
21-
rule.source.input.file &&
22-
!isFileInArray(rule.source.input.file, includeFiles)
23-
) {
24-
return;
25-
}
9+
return function (root) {
10+
if (
11+
ignoreFiles.length &&
12+
root.source.input.file &&
13+
isFileInArray(root.source.input.file, ignoreFiles)
14+
) {
15+
return;
16+
}
17+
if (
18+
includeFiles.length &&
19+
root.source.input.file &&
20+
!isFileInArray(root.source.input.file, includeFiles)
21+
) {
22+
return;
23+
}
2624

25+
root.walkRules((rule) => {
2726
const keyframeRules = [
2827
'keyframes',
2928
'-webkit-keyframes',
@@ -50,7 +49,7 @@ module.exports = function postcssPrefixSelector(options) {
5049

5150
return prefixWithSpace + selector;
5251
});
53-
},
52+
});
5453
};
5554
};
5655

‎test/test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,16 @@ it('should prefix a selector. Use ".hello .world"', () => {
287287
assert.equal(out, expected);
288288
});
289289

290-
it('should prefix postcss nested selectors', () => {
291-
const out = postcss()
292-
.use(postcssNested)
293-
.use(prefixer({ prefix: '.stuff' }))
294-
.process(getFixtureContents('nested-selectors.postcss')).css;
290+
// it('should prefix postcss nested selectors', () => {
291+
// const out = postcss()
292+
// .use(postcssNested)
293+
// .use(prefixer({ prefix: '.stuff' }))
294+
// .process(getFixtureContents('nested-selectors.postcss')).css;
295295

296-
const expected = getFixtureContents('nested-selectors.expected.css');
296+
// const expected = getFixtureContents('nested-selectors.expected.css');
297297

298-
assert.equal(out, expected);
299-
});
298+
// assert.equal(out, expected);
299+
// });
300300

301301
function getFixtureContents(name) {
302302
return fs.readFileSync(`test/fixtures/${name}`, 'utf8').trim();

0 commit comments

Comments
 (0)
Failed to load comments.