-
-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Description
Some SCSS variables are not being replaced during libsass processing and are ending up as text in the CSS. Found via W3 validator in CSS mode.
E.g. this is in the main.<cache-buster>.css:
[data-bs-theme="dark"] .table-dark, [data-bs-theme="dark"] table,
[data-bs-theme="dark"] [data-bs-theme="dark"] table {
--bs-table-color: inherit;
--bs-table-bg: $body-bg-dark;
background: #17181c;
border-color: #23262f; }Steps to reproduce
- Set up a test site
npm create thulite@latest thulite-css-validation-test -- --template dokscd thulite-css-validation-testnpm install- Start the hugo server:
npm run dev - Browse to the CSS
- In your browser 'view-source'
- Click on the 'main.<hash>.css' link.
- OR use your browser developer tools and set to NOT display source.
- Search for $body-bg-dark.
- Observe it is present in the 'live' CSS.
- Cancel the server (Ctrl-C)
- Build the site:
hugo --gc
- Obtain and install W3 Nu Validator
- Download the latest release from
https://github.com/validator/validator/releases- E.g.
wget https://github.com/validator/validator/releases/download/latest/vnu.jar
- E.g.
- Ensure you have a recent-ish Java JRE (I use openjdk-17-jre from Debian 12 'Bookworm')
- Download the latest release from
- Use the Validator and observe the results
- Execute
java -jar ./vnu.jar --skip-non-css $(find public -name '*.css' | tr $'\n' ' ')
- Execute
- Go to the file and line containing an error like
error: CSS: “color”: Parse Error.- In our case, these are usually unprocessed variables.
Test repo at: https://github.com/danielfdickinson/thulite-css-validation-test
Expected result
CSS files should contain only valid CSS.
Actual result
CSS files contain unprocessed SCSS variables.
Environment
hugo v0.148.2-40c3d8233d4b123eff74725e5766fc6272f0a84d+extended linux/amd64 BuildDate=2025-07-27T12:43:24Z VendorInfo=gohugoio
10.9.2
Additional notes
I do not have a fix for this yet, won't be immediately adding a PR.
Also, on further review it appears other SCSS processing is not behaving as expected
when there are CSS variables involved (e.g. setting a --css-variable-as-property: value). Not sure if this a bootstrap or sass issues (dartsass as transpiler produces the same errors).
Metadata
Metadata
Assignees
Labels
No labels