Nuxt error with colors #71
Reference in New Issue
Block a user
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?
Can you fix it?
Fixed.
Cause —
frontend/app/assets/css/colors.scssusedred,greenandgrayas unquoted map keys. Sass parses those words as colour values, not strings, sotheme-vars()interpolating them into--color-#{$name}triggered the "you probably don't mean to use the color value red in interpolation here" warning on every frontend build.Change —
frontend/app/assets/css/colors.scss: quoted the colour-named keys in both theme maps ("red","green","gray") so they stay strings, plus a short comment saying why. Nothing else in the file needed touching — the other keys (dark,light,background, therarity-*keys, the accent maps) are not Sass colour keywords, and no other stylesheet reads these maps.Verification
sass1.99 (the frontend's pinned version): the warning is gone, and the emitted CSS is byte-for-byte identical to the pre-fix output —--color-red: #e06c75,--color-green,--color-grayare still produced in both:rootand[data-theme="light"], so the 17var(--color-red|green|gray)usages in components keep resolving. (Confirmed the warning does appear when compiling the file atHEAD, so the fix is what removed it.)tests/theme-color-vars.test.js, in the style of the existing source-reading tests: it extracts the$themes/$accentskeys and asserts none is a bare CSS colour keyword, and that the three colour-named keys are quoted with their hex values in both maps. It fails against the pre-fix file and passes now.npm testfrom the repo root: 246 tests, 246 pass, 0 fail.Implementation is ready for review: #76