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

Fix Sass imports in Parcel example for Windows #495

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

julien-deramond
Copy link
Member

@julien-deramond julien-deramond commented Sep 3, 2024

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 the bootstrap.scss file in the node_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:

  1. Use @import "~/node_modules/bootstrap/scss/functions";
  2. Use @import "../../node_modules/bootstrap/scss/functions";
  3. Use @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:

You can also import our stylesheets individually if you want. Read our Sass import docs for details.

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.

@julien-deramond julien-deramond marked this pull request as ready for review September 3, 2024 06:52
Copy link
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

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

Works for me

@julien-deramond
Copy link
Member Author

@XhmikosR FYI, if you want to double-check this PR. Otherwise, it's ready to be merged :)

@XhmikosR
Copy link
Member

XhmikosR commented Sep 3, 2024

Weird that parcel doesn't work, but I confirm this fixes the issue on Windows.

@XhmikosR XhmikosR merged commit 3f25983 into main Sep 3, 2024
12 checks passed
@XhmikosR XhmikosR deleted the main-jd-fix-parcel-sass-imports branch September 3, 2024 14:04
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.

Route to stylesheet functions fails w/ Parcel
3 participants