Skip to content

Improved Webpack-style tilde-import support for Sass #106

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

Merged
merged 1 commit into from
Nov 29, 2020

Conversation

kmark
Copy link
Contributor

@kmark kmark commented Nov 17, 2020

The current solution for dealing with sass/scss imports which are
prefixed with a tilde (~) is to strip the symbol from the import line.
This breaks down when dart-sass itself starts pulling in subsequent
imports that are also tilde-prefixed.

This change introduces a simple algorithm to climb the filesystem tree
looking for the imported module/file in a node_modules directory.

This is enabled by default since it replaces behavior which is already
forced on.

This change is covered under the existing "with a Bootstrap import"
test.

The current solution for dealing with sass/scss imports which are
prefixed with a tilde (~) is to strip the symbol from the import line.
This breaks down when dart-sass itself starts pulling in subsequent
imports that are also tilde-prefixed.

This change introduces a simple algorithm to climb the filesystem tree
looking for the imported module/file in a node_modules directory.

This is enabled by default since it replaces behavior which is already
forced on.

This change is covered under the existing "with a Bootstrap import"
test.
@mrmckeb
Copy link
Owner

mrmckeb commented Nov 23, 2020

Thanks @kmark, this looks good - thanks for the contribution.

The initial work was admittedly a quick hack to get it working, and I understand why that wouldn't scale.

Do you think it makes sense to have this as the default setting? I suspect many people are using this (from my experience on projects and from issues here). We could do that in a new major version.

@mrmckeb mrmckeb self-assigned this Nov 23, 2020
@mrmckeb mrmckeb added the enhancement New feature or request label Nov 23, 2020
@mrmckeb mrmckeb merged commit 49c5bd0 into mrmckeb:develop Nov 29, 2020
@mrmckeb
Copy link
Owner

mrmckeb commented Nov 29, 2020

This is now available, and on by default in v3. Thanks @kmark!

https://github.com/mrmckeb/typescript-plugin-css-modules/releases/tag/v3.0.0

@kmark
Copy link
Contributor Author

kmark commented Nov 29, 2020

Hey @mrmckeb,

Sorry for the delay in getting back to you. Thanks for the merge! This is enabled by default which should mostly match what people currently expect. Were you wondering if we should have it opt in instead?

Thanks again,
Kevin

@kmark
Copy link
Contributor Author

kmark commented Nov 29, 2020

I think the only way to keep from bumping the major version would probably be to have the setting have 3 states: off, old (default), and on. I agree that bumping to 3.0 is the right call since I think most people expect it to work this way already, which should make it a trivial upgrade for them.

@mrmckeb
Copy link
Owner

mrmckeb commented Nov 30, 2020

No problem @kmark - as someone that often takes days to get to issues, I completely understand.

Let me know how this release goes, and if there are any issues!

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

Successfully merging this pull request may close these issues.

2 participants