Skip to content

Commit

Permalink
fix: 修复exclude失效的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-lau committed Jul 26, 2024
1 parent eee6da9 commit 7129d99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ var converter = function converter() {
var remRootValue = baseSize.rem;
var vwRootValue = baseSize.vw;
remReplace = createPxReplacer(remRootValue, minPixelValue, unitPrecision, 'rem');
vwReplace = createPxReplacer(vwRootValue, minPixelValue, unitPrecision, 'vw'); // whole file
vwReplace = createPxReplacer(vwRootValue, minPixelValue, unitPrecision, 'vw'); // whole file, when exclude match this whole file, skip the comment marker

isExcludeFile = css.nodes.some(function (item) {
isExcludeFile || (isExcludeFile = css.nodes.some(function (item) {
return item.type === 'comment' && item.text.trim() === commentOfDisableAll;
}); // not convert rem
})); // not convert rem

if (isExcludeFile || css.nodes.some(function (item) {
return item.type === 'comment' && item.text.trim() === commentOfDisableRem;
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ const converter = (options = {}) => {
'vw'
);

// whole file
isExcludeFile = css.nodes.some(
// whole file, when exclude match this whole file, skip the comment marker
isExcludeFile ||= css.nodes.some(
item =>
item.type === 'comment' && item.text.trim() === commentOfDisableAll
);
Expand Down

0 comments on commit 7129d99

Please sign in to comment.