Skip to content

Add .env SASS_PATH support #51

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 4 commits into from
Oct 19, 2019
Merged

Add .env SASS_PATH support #51

merged 4 commits into from
Oct 19, 2019

Conversation

PsiRadish
Copy link
Contributor

Fixes #49

Adds support for resolving @imports in *.scss files using the paths defined in SASS_PATH in a .env file at the project root.

Works by reading in the .env file during initialization and adding its SASS_PATH value (after some fix-up to relative paths) to process.env.SASS_PATH, where dart-sass will find it and use it.

Unfortunately, like #50 the other currently pending pull request on this repo, I too have failing *.scss tests with empty received snapshot, even with no modifications from upstream origin/develop. All other tests are passing.

@mrmckeb
Copy link
Owner

mrmckeb commented Oct 9, 2019

Thanks @PsiRadish, this looks good - I'm just unsure as to if we should be using this - or instead just use the dotenv package?

I also think we might want to allow people to pass in a file name as an option. What do you think?

@mrmckeb
Copy link
Owner

mrmckeb commented Oct 14, 2019

@PsiRadish Can we make a change to this PR to try to load that file with dotenv?

@PsiRadish
Copy link
Contributor Author

I also think we might want to allow people to pass in a file name as an option. What do you think?

I said the same in a MAYBE TODO in comments, so yeah, sounds good.

@PsiRadish Can we make a change to this PR to try to load that file with dotenv?

That is how I had it work in my first commit. However, I wasn't sure there weren't other environment variables typescript-plugin-css-modules or its dependencies used that one would not want set with values from a "random" React project .env file. If you are sure (or at least surer than I), then yeah, why not?

@mrmckeb mrmckeb merged commit c9f17cf into mrmckeb:develop Oct 19, 2019
@mrmckeb
Copy link
Owner

mrmckeb commented Oct 19, 2019

Thanks for this work! I'll make some changes, and then release tomorrow.

@mrmckeb
Copy link
Owner

mrmckeb commented Oct 20, 2019

Hi @PsiRadish, we've just released v2.0.0 which includes this PR and other changes.

Release notes and migration steps can be found here: https://github.com/mrmckeb/typescript-plugin-css-modules/releases/tag/v2.0.0

Please let me know if you have any other issues or feedback! And thanks for your patience.

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.

Does not use SASS_PATH environment variable when resolving imports
2 participants