Skip to content

Commit

Permalink
fix(): missing style value is important #6
Browse files Browse the repository at this point in the history
  • Loading branch information
GitOfZGT committed Nov 8, 2021
1 parent 4aa1d6e commit 9621ba1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zougt/some-loader-utils",
"version": "1.3.3",
"version": "1.3.4",
"description": "implementation for less-loader or sass-loader. Compiles Less or sass to CSS.",
"license": "MIT",
"repository": "GitOfZGT/some-loader-utils",
Expand Down
16 changes: 5 additions & 11 deletions src/postcss-addScopeName.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default (
(word) => `${word}.${scopeName}`
);
}
return `.${scopeName} ${selector}`;
return `.${scopeName}\x20${selector}`;
}
// allStyleVarFiles的个数与allCssCodes对应的
// 除去startIndex的,其他的css转成ast
Expand Down Expand Up @@ -69,7 +69,7 @@ export default (
) {
childNodes.push(themeRuleNodeMap[prop]);
currentThemeProps[prop] =
currentRuleNodeMap[prop].value;
currentRuleNodeMap[prop];
}
delete themeRuleNodeMap[prop];
});
Expand All @@ -89,7 +89,7 @@ export default (
rule.nodes.forEach((node) => {
if (
node.type === 'decl' &&
currentThemeProps[node.prop] === node.value
currentThemeProps[node.prop] === node
) {
node.remove();
}
Expand All @@ -108,16 +108,10 @@ export default (
node.type === 'decl' && node.prop === key
)
) {
tRule.append({
prop: key,
value: currentThemeProps[key],
});
tRule.append(currentThemeProps[key].clone());
}
}
firstThemeRule.append({
prop: key,
value: currentThemeProps[key],
});
firstThemeRule.append(currentThemeProps[key].clone());
});

// 保持themeRules的顺序对应 opts.allStyleVarFiles的顺序,然后添加scopeName
Expand Down

0 comments on commit 9621ba1

Please sign in to comment.