Fix Sass imports in Parcel example for Windows #495
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #321
Description
This PR addresses issue #321.
On macOS, there are no problems—everything compiles and launches as expected. However, on Windows, we were able to replicate the issue with @louismaximepiton.
The import statement
@import "bootstrap/scss/bootstrap"
works correctly in our step-by-step guide because it references thebootstrap.scss
file in thenode_modules
directory. However, when attempting something similar to the Parcel example, such as@import "bootstrap/scss/functions"
, it fails. This is because Parcel or the Parcel Sass Transformer cannot locate the file named_functions.scss
.(it's referenced at several locations—e.g. parcel-bundler/parcel#6002, parcel-bundler/parcel#3704, etc.)
While Sass handles this by default on other systems, it fails to do so with Parcel on Windows for these specific imports.
We considered three potential solutions to fix this issue for Windows users:
@import "~/node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/functions";
@import "~/node_modules/bootstrap/scss/_functions";
We opted for the simplest approach, which doesn't require users to know the exact filenames (including underscores) or the precise relative paths.
Upstream Parcel Guide
The upstream documentation for Parcel says:
In the link, we use a relative path to target the files, so it'll work as well. I don't think it's needed to modify the upstream guide.