sass / dart-sass

The reference implementation of Sass, written in Dart.
https://sass-lang.com/dart-sass
MIT License
3.9k stars 352 forks source link

Using `math.random()` in css module leads to a wrongly generated class names #2150

Closed orangecoloured closed 8 months ago

orangecoloured commented 9 months ago

I used create-preact to initialise my app. It uses vite v4.3.2 and sass v1.69.5.

I have a scss module with a code that contains math.random().

.someClass {
    some-value: 100px + math.random(1000);
}

And because of the math.random() as a result the names that are assigned to the html elements are not that are being generated and loaded in the stylesheet.

With the math.random()

Screenshot 2023-12-19 at 11 18 02 PM

Without the math.random()

Screenshot 2023-12-19 at 11 17 39 PM

For clarity. When the math.random() is used the generated class name that is used for class="" has 1lzbo part in the class name, but in the injected