Deprecation warnings due to unpinned global Sass version
Description
The development Dockerfile installs Sass globally without pinning a version:
npm install -g sassMeanwhile, package.json runs Sass through the build:css:sass script but does not declare Sass as a project dependency:
"build:css:sass": "sass wger/core/static/scss/main.scss wger/core/static/bootstrap-compiled.css"Consequently, every clean development-image build can install a different Sass version, depending on which release is latest at build time.
Recent Dart Sass versions emit hundreds of deprecation warnings while compiling wger’s customized Bootstrap 5.3.8 stylesheet. Compilation still succeeds today, but some of the deprecated syntax is scheduled for removal in future Sass versions.
A future container rebuild could therefore change from producing warnings to failing the CSS build, even when the wger source code has not changed.
Steps to reproduce
Build the development image without using the existing cache:
docker compose build --no-cache webStart the development environment:
docker compose up --watchEnter the web container:
docker compose exec web /bin/bashRun the bootstrap command:
wger bootstrapObserve the Sass warnings emitted while compiling:
wger/core/static/scss/main.scss
The compiler being selected by the container can be inspected with:
which sass
sass --version
npm ls sassnpm ls sass does not list Sass as a direct project dependency because the compiler is installed globally by the Dockerfile.
Example warnings
The build reports that Sass @import is deprecated:
DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
╷
19 │ @import "../../../../node_modules/bootstrap/scss/functions";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
wger/core/static/scss/main.scss 19:9 root stylesheetThe same warning is produced for the other Bootstrap imports:
DEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
╷
20 │ @import "../../../../node_modules/bootstrap/scss/variables";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
wger/core/static/scss/main.scss 20:9 root stylesheetDEPRECATION WARNING [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
╷
41 │ @import "../../../../node_modules/bootstrap/scss/bootstrap";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
wger/core/static/scss/main.scss 41:9 root stylesheetBootstrap also uses the deprecated Sass if() syntax:
DEPRECATION WARNING [if-function]: The Sass if() syntax is deprecated in favor of the modern CSS syntax.
╷
58 │ $_args: append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules/bootstrap/scss/_functions.scss 58:30 @import
wger/core/static/scss/main.scss 19:9 root stylesheetGlobal built-in functions used by Bootstrap are deprecated:
DEPRECATION WARNING [global-builtin]: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.
Use color.mix instead.
╷
207 │ @return mix(white, $color, $weight);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules/bootstrap/scss/_functions.scss 207:11 tint-color()
node_modules/bootstrap/scss/_variables.scss 79:12 @import
wger/core/static/scss/main.scss 20:9 root stylesheetLegacy color functions are also deprecated:
DEPRECATION WARNING [color-functions]: red() is deprecated.
Suggestion:
color.channel($color, "red", $space: rgb)
╷
185 │ "r": red($color),
│ ^^^^^^^^^^^
╵
node_modules/bootstrap/scss/_functions.scss 185:10 luminance()
node_modules/bootstrap/scss/_functions.scss 174:8 contrast-ratio()
node_modules/bootstrap/scss/_functions.scss 159:22 color-contrast()
node_modules/bootstrap/scss/_variables.scss 846:42 @import
wger/core/static/scss/main.scss 20:9 root stylesheetThe compiler eventually suppresses hundreds of duplicate messages:
WARNING: 313 repetitive deprecation warnings omitted.These are currently warnings rather than errors, so the CSS is still generated. However, suppressing the messages would not protect the build after Sass removes the deprecated syntax.
Actual behavior
The development Dockerfile installs whichever Sass release is latest when the image is built:
npm install -g sassThis makes the frontend build dependent on external state.
Two development images built from the same wger commit at different times can use different Sass compiler versions and produce different warnings, output, or build results.
Expected behavior
The Sass compiler should be declared and locked as a project development dependency.
The same compiler version should be used consistently in:
- Local development
- Development containers
- CI builds
wger bootstrap
A Docker image rebuild should not upgrade the Sass compiler unless the project deliberately changes the dependency version.
Proposed solution
Declare an exact compatible Sass version in package.json:
"devDependencies": {
"@wger-project/react-components": "26.7.24",
"sass": "1.78.0"
}Regenerate package-lock.json and remove the unpinned global installation from extras/docker/development/Dockerfile:
&& apt-get clean \
- && rm -rf /var/lib/apt/lists/* \
- && npm install -g sass
+ && rm -rf /var/lib/apt/lists/*The Dockerfile already installs the project dependencies and runs the Sass build:
RUN npm install \
&& npm run build:css:sass \
&& pip3 install --break-system-packages --user --group dev --editable .When npm executes a package script, it automatically adds the project’s node_modules/.bin directory to PATH. Therefore:
npm run build:css:sasswill use the locally declared Sass compiler.
Why use an exact version?
Using a caret range:
"sass": "^1.78.0"would allow later Sass 1.x releases when the lockfile is updated or regenerated:
>=1.78.0 and <2.0.0Several relevant deprecations were introduced in later Sass 1.x releases. A minor-version update can therefore change the build output or introduce new warnings even though the major version remains 1.
Using an exact version:
"sass": "1.78.0"makes compiler selection reproducible until the project deliberately upgrades and tests a newer version.
Verification
With Sass declared as:
"sass": "1.78.0"the selected compiler is:
1.78.0 compiled with dart2js 3.5.2The existing build command completes successfully:
npm run build:css:sassNo Sass deprecation warnings from the report above are emitted.
Longer-term consideration
Pinning Sass is a build-reproducibility fix, not a permanent migration of the deprecated SCSS.
The underlying deprecations exist in both:
- wger’s
main.scssimports - Bootstrap 5.3.8’s internal SCSS implementation
A longer-term solution will require upgrading Bootstrap or migrating the affected SCSS to the modern Sass module and function APIs.
Until that migration is possible, pinning Sass prevents an unrelated container rebuild from unexpectedly upgrading the compiler and breaking the development environment.
Source: wger-project/wger