Migrate Sass from @import to @use/@forward module system #18
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Athemis/ds4#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Background
The Sass
@importrule is deprecated and will be completely removed in Dart Sass 3.0.0. Currently, we're still using@importin all SCSS files, which causes deprecation warnings during build:Why migrate?
@importwill stop working in Dart Sass 3.0.0Current Status
The deprecation warning has been temporarily suppressed in
rollup.config.js:This is only a short-term solution and should be replaced with a complete migration.
What needs to be done?
1. Main stylesheet (
scss/ds4.scss)@importstatements with@use2. Partial files (all
_*.scssfiles)Affected files:
scss/global/_*.scss(3 files)scss/components/shared/_*.scss(13 files)scss/components/actor/_*.scss(14 files)scss/components/item/_*.scss(3 files)scss/components/dice/_*.scss(1 file)scss/utils/_*.scss(variables, mixins, colors)For each file, check:
@forward@useand use namespace3. Test Rollup configuration
rollup-plugin-stylerplugin must work with the new module system@rollup/plugin-sass,vite-plugin-sass)4. Testing
Migration Tools
Sass provides an official migrator tool:
⚠️ Warning: The tool cannot automatically handle all edge cases, especially:
Challenges
Namespace management: Variables will no longer be global
$primary-colorbecomescolors.$primary-colorRollup plugin compatibility:
rollup-plugin-stylermay have issues with pure@useimportsBreaking changes: If the plugin is not compatible, we may need to adjust the build process
Resources
Acceptance Criteria
@importstatements are replaced with@use/@forwardrollup.config.jsEstimated Effort
Medium to high - depending on plugin compatibility and number of manual adjustments
Context
No response