Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sass/node-sass -> sass/dart-sass #295

Closed

Conversation

dearlordylord
Copy link

To overcome the issue #294 we can switch to https://www.npmjs.com/package/sass .

This code works quite well for my project. Our css person uses :not selector extensively so it's not viable to change codebase.

Also, the original node-sass issue (sass/node-sass#2330) seems to exist for a couple years already, therefore it's not clear when and if it will be resolved.

@znerol
Copy link
Collaborator

znerol commented Sep 6, 2020

I wholeheartedly agree with swapping out node-sass for dart-sass. The PR needs some love though, review follows.

Copy link
Collaborator

@znerol znerol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work so far. The PR looks promising.

Comment on lines -83 to +85
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid changing coding style in unrelated places if possible (even if the change of whitespace is correct). This adds noise to the PR and makes review harder.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving it to a separate PR

Comment on lines -114 to +116
]
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Avoid unnecessary changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving it to a separate PR

Comment on lines +131 to +143
for (const possibleFile of possibleFiles) {
if (!possibleFile.startsWith('./') && !possibleFile.startsWith('{}') && !isAbsolute) {
possibleFiles.push('./' + possibleFile);
possibleFiles.push('{}/' + possibleFile);
}
}

for (const possibleFile of possibleFiles) {
if (possibleFile.startsWith('./') && !possibleFile.startsWith('{}') && !isAbsolute) {
possibleFiles.push('{}/' + possibleFile.substring('./'.length));
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the possibleFiles array while looping over it. Avoid that and instead do something like this:

if (!isAbsolute) {
  let additionalPossibleFiles = [];
  for (const possibleFile of possibleFiles) {
    if(...) {
      additionalPossibleFiles.push(...)
    }
  }
  possibleFiles = possibleFiles.concat(additionalPossibleFiles);
}

Also I'm wondering why it is necessary to add those variants. Is this something required by dart-sass or is it an additional feature you like to include in meteor-scss package?

Copy link
Author

@dearlordylord dearlordylord Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the possibleFiles

I'd gladly do it but I tried to go along the project code style. It's already done in a bunch of places. Should we go forward with immutability in only one place, leaving it mutable in older code? If not, shouldn't it be a matter of a separate pull request (probably, together with code formatting)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something required by dart-sass or is it an additional feature you like to include in meteor-scss package?

Rechecked with my project, doesn't seem to be needed indeed.

Comment on lines -132 to +147
return { absolute: isAbsolute, path: possibleFile };
return { absolute: isAbsolute, path: possibleFile };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving it to a separate PR

Comment on lines +151 to +152
console.debug('imported style not found in possible files', possibleFiles);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray debug message. Please remove.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Comment on lines -260 to +293
let possibleFilePath, foundFile;
let possibleFilePath, foundFile, possibleFiles = [];

for (let includePath of _includePaths) {
possibleFilePath = path.join(includePath, importPath);
foundFile = getRealImportPathFn(possibleFilePath);
if (!importPath.match(/\.s?(a|c)ss$/)) {
for (const extension of expectedExtensions){
possibleFiles.push(`${importPath}.${extension}`);
}
} else {
possibleFiles.push(importPath);
}

if (foundFile) {
return foundFile;
for (let includePath of _includePaths) {
for (let possibleFile of possibleFiles) {
possibleFilePath = path.join(includePath, possibleFile);
foundFile = getRealImportPathFn(possibleFilePath);
if (foundFile) {
return foundFile;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here: Is this something required by dart-sass or is it an additional feature you like to include in meteor-scss package?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with my app, doesn't seem to be needed indeed.

@@ -297,6 +323,7 @@ function _loadIncludePaths(config) {
} else {
_includePaths = [];
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving it into a separate PR

Comment on lines -308 to +336
return _getConfig('scss-config.json') || {};
return _getConfig('scss-config.json') || {
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated indeed. Thanks!

@dearlordylord
Copy link
Author

Thank you for feedback @znerol . A new PR coming soon.

@dearlordylord
Copy link
Author

@znerol opened #296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants