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

SASS is deprecating @import #2084

Open
stefanv opened this issue Dec 18, 2024 · 3 comments
Open

SASS is deprecating @import #2084

stefanv opened this issue Dec 18, 2024 · 3 comments

Comments

@stefanv
Copy link

stefanv commented Dec 18, 2024

See https://sass-lang.com/documentation/breaking-changes/import/ and executablebooks/sphinx-design#231

Bootstrap issue (they're aiming for v6)

I think what we want in our index.scss is to do:

@use "sections/skip-link" as *;

For all modules we expose to users, but, interally, to use:

@use "~bootstrap/scss/bootstrap" as *;

for modules we don't export, and then access those using the bootstrap. namespace.

@drammock
Copy link
Collaborator

They have an automated migration tool. I just tried it like this:

$ sass-migrator module --migrate-deps src/pydata_sphinx_theme/assets/styles/pydata-sphinx-theme.scss node_modules/bootstrap/scss/_functions.scss

adding bootstrap's _functions.scss as an additional entrypoint was required to get the tool to run. It changed 36 files. Example: in _accessibility.scss it adds @use "../variables/color" as variables-color; to the top, and then things like

$target-color-contrast-dark: $foundation-black,

change to

$target-color-contrast-dark: variables-color.$foundation-black,

Might be a good starting point but I'm not savvy enough to know off the top of my head if this will work before BS6 or if we have to wait for BS6 before we can change our code.

@stefanv
Copy link
Author

stefanv commented Dec 18, 2024

I ran the migration tool, and I don't think it does what you want as a package author. It is useful for end user projects, because it changes imports to using namespaces—fewer chances of conflicts.

But, as a style library you only use @import to bring definitions into a single namespace, that the user then imports. So, my recommendation is what was posted above.

@stefanv
Copy link
Author

stefanv commented Dec 19, 2024

Looks like @forward is very similar to @use ... as *, but there are subtle namespace differences that I have to figure out.

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