Files
adastra_app/docs/decisions/0012-scss-bootstrap-import-deprecation.md
T
julien c8e2fba13e docs(adr): convert all ADRs to MADR 2.1.2 format
Rewrites all 12 frontend ADRs from a custom structure to the MADR 2.1.2
template required by the VS Code ADR Manager extension: bullet metadata
(Status/Date), standardised section headings, "Chosen option: X, because Y"
wording, and explicit Pros/Cons blocks per option.
2026-04-26 16:50:34 +02:00

58 lines
2.6 KiB
Markdown

# Silence the Sass @import deprecation for the Bootstrap import chain
- Status: accepted
- Date: 2026-04-26
## Context and Problem Statement
Bootstrap 5 relies on Sass's `@import` rule and `!default` variable overrides: our custom `_variable.scss` must be loaded before Bootstrap's `variables.scss` so that Bootstrap picks up our values via the `!default` mechanism. Dart Sass 1.80+ deprecates `@import` in favour of the `@use` module system. How should the deprecation be addressed?
## Decision Drivers
- Bootstrap 5's `!default` override mechanism is incompatible with `@use` module scopes — variables loaded via `@use` do not flow into Bootstrap's module scope.
- Other Dart Sass deprecations (`color.red/green/blue()`, global `if()`) were fixed properly.
## Considered Options
- Silence the `@import` deprecation via `angular.json`
- Migrate to `@use` with `@use "bootstrap" with (...)`
- Wait for Bootstrap 6
## Decision Outcome
Chosen option: "Silence the `@import` deprecation via `angular.json`", because the `@use` migration is blocked by Bootstrap 5's architecture and Bootstrap 6 (which adopts `@use` natively) is not yet released.
The deprecation is suppressed in `angular.json` via `stylePreprocessorOptions.sass.silenceDeprecations: ["import"]`. The existing `@import`-based Bootstrap loading chain is kept intact. All other Dart Sass deprecations are fixed properly.
### Positive Consequences
- Bootstrap customisation works correctly with no behaviour change.
- No risk of introducing regressions by attempting an incompatible migration now.
### Negative Consequences
- Deprecation is silenced rather than fixed. `@import` will be removed in Dart Sass 3.0.
## Pros and Cons of the Options
### Silence the `@import` deprecation
- Good, because no behaviour change — existing variable overrides continue to work.
- Bad, because the underlying issue is deferred, not resolved.
### Migrate to `@use` with `@use "bootstrap" with (...)`
- Good, because fully resolves the deprecation.
- Bad, because requires rewriting all Bootstrap variable overrides using `with ()` syntax — significant effort.
- Bad, because the `with ()` syntax has limitations compared to `!default` chaining.
### Wait for Bootstrap 6
- Good, because Bootstrap 6 adopts `@use` natively — migration path will be documented by the Bootstrap team.
- Bad, because Bootstrap 6 release date is unknown; deferring means living with the silenced warning.
## Links
- Related to [ADR 0003](0003-dual-ui-library-progressive-migration.md)
- Future action: when Bootstrap 6 is released with `@use` support, migrate the import chain, remove the `silenceDeprecations` entry, and supersede this ADR.