Andarist / Andarist/stylis-plugin-extra-scope
why first selector was modified?
- 主要语言
- JavaScript
- 星标
- 23
- 派生
- 14
- PR 合并指标
- 30 天内没有已合并 PR
描述
Work with styled-component v5, and I found that first selector will be modified, and this made the whole page's style broken.

Here is my test code
```js
export function addCssScope(scopes: string[]) {
// FORM:
// https://github.com/Andarist/stylis-plugin-extra-scope/blob/master/src/index.js
const extraScopePlugin: StylisPlugin = (context, content, selectors) => {
if (context === -2) {
console.log('[selectors]', selectors);
console.log('[content] ', content);
console.log('\n\n');
return;
}
if (context !== -1) {
return;
}
console.log('[before] selectors', selectors);
const selector = selectors[0];
selectors[0] = `.${scopes[0]} ${selector}`;
for (let i = 1; i < scopes.length; i++) {
selectors.push(`.${scopes[i]} ${selector}`);
}
console.log('[after] selectors', selectors);
};
Object.defineProperty(extraScopePlugin, 'name', {
value: 'addCssScopePlugin',
});
return extraScopePlugin;
}
// .......
```
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。