(Please see https://github.com/StarFahx/DenoCssBugRepro for a repo with reproduction steps for this bug. I've copied out the info from the readme file there below:)
I've come across a bug that seems quite inconsistent to recreate. I've not been able to figure out a "minimal" reproduction: it seems to strike in the middle of development with no particular rhyme or reason, so I have taken the most recent project I was working on when it struck and removed any identifying features.
The issue is that sometimes Deno decides not to load in a css module (or sass module, if using sass-embedded: which I often do, but I've recreated the issue here from scratch with pure css modules only). When running deno task dev, the module(s) that are affected will not appear in the html at all; when running deno task build, the relevant css appears in _fresh/client/assets/server-entry-{hash}.css, which is not loaded into the html either. This I think is the key to figuring out why it's inconsistent and why only some modules are affected, but I'm not familiar enough with Fresh to hunt this down myself right now.
I am able to work around the issue by updating _fresh/server/server-entry.mjs manually: an entryAssets const is declared, and if the server-entry css file path is added to the array manually, the modules load as expected. This is not a particularly helpful workaround when developing as it only works with a production built version of the site, and does not therefore have file-tracking or any other useful dev features!
Recreation Steps
- Pull this repo
- In
/src, run deno task dev
- Opening the site in your browser (I am using Firefox v152.0.1, and running Deno v2.8.3 on Linux), confirm that the whole content of the page is full-width
- Confirm the same for the site hosted using
deno task build && deno serve --allow-read _fresh/server.js.
- Amend
_fresh/server/server-entry.mjs as described in the workaround above.
- Re-run the script in step 4 and confirm that most (but not all) of the content is fit to a central container, and that the title text is red.
(Please see https://github.com/StarFahx/DenoCssBugRepro for a repo with reproduction steps for this bug. I've copied out the info from the readme file there below:)
I've come across a bug that seems quite inconsistent to recreate. I've not been able to figure out a "minimal" reproduction: it seems to strike in the middle of development with no particular rhyme or reason, so I have taken the most recent project I was working on when it struck and removed any identifying features.
The issue is that sometimes Deno decides not to load in a css module (or sass module, if using sass-embedded: which I often do, but I've recreated the issue here from scratch with pure css modules only). When running
deno task dev, the module(s) that are affected will not appear in the html at all; when runningdeno task build, the relevant css appears in_fresh/client/assets/server-entry-{hash}.css, which is not loaded into the html either. This I think is the key to figuring out why it's inconsistent and why only some modules are affected, but I'm not familiar enough with Fresh to hunt this down myself right now.I am able to work around the issue by updating
_fresh/server/server-entry.mjsmanually: anentryAssetsconst is declared, and if the server-entry css file path is added to the array manually, the modules load as expected. This is not a particularly helpful workaround when developing as it only works with a production built version of the site, and does not therefore have file-tracking or any other useful dev features!Recreation Steps
/src, rundeno task devdeno task build && deno serve --allow-read _fresh/server.js._fresh/server/server-entry.mjsas described in the workaround above.