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

Support .import.scss suffix #904

Closed
bgotink opened this issue Nov 30, 2020 · 8 comments
Closed

Support .import.scss suffix #904

bgotink opened this issue Nov 30, 2020 · 8 comments

Comments

@bgotink
Copy link

bgotink commented Nov 30, 2020

  • Operating System: any
  • Node Version: any
  • NPM Version: any
  • webpack Version: 4.x
  • sass-loader Version: 10.0.5

Feature Proposal

Support loading files with the .import.scss extension when used with @import

Feature Use Case

As a Sass library author I can support usage of my library using @use and @import by providing two files: /path/to/_file.scss for @use and /path/to/_file.import.scss for @import.
The _file.scss uses regular names for all variables and mixins, while the _file.import.scss exposes all of these things with a prefix to prevent name clashes.

Sass doesn't pass what method is used to the importer as far as I could tell, so it doesn't look like the importer can perform this logic itself.
However, by resolving the path to /path/to/_file without any extensions sass itself will resolve this correctly, finding .import.scss files when they exist.

@alexander-akait
Copy link
Member

alexander-akait commented Nov 30, 2020

Sorry, it is not official, if you need this, please open an issue in sass repo and when they implemented this we will support it too

@bgotink
Copy link
Author

bgotink commented Nov 30, 2020

@alexander-akait I'm not sure what I have to ask in the sass repo.
While the .import.scss system is not widely documented on the sass website, this is officially supported: https://sass-lang.com/documentation/at-rules/import#import-only-files

My usecase only explains the usecase. I'm not asking for you to invent something new.

@alexander-akait
Copy link
Member

alexander-akait commented Dec 1, 2020

If it is in docs we are supporting this

@bgotink
Copy link
Author

bgotink commented Dec 1, 2020

Thanks for clarifying that!

Could this ticket be re-opened? This feature doesn't work with sass-loader at this point in time.

@alexander-akait
Copy link
Member

I can't open it, because it works, if it doesn't work provide reproducible test repo, double check you use sass (dart-sass), it doesn't work on node-sass

@bgotink
Copy link
Author

bgotink commented Dec 1, 2020 via email

@alexander-akait
Copy link
Member

Please provide reproducible test repo and I will reopen this if we will have bug

@bgotink
Copy link
Author

bgotink commented Dec 2, 2020

I've opened #905, which contains a failing test.

While creating the test I noticed there's a pretty clean workaround, there's more info in the PR.

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

No branches or pull requests

2 participants