-
-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot reloading of inlined CSS not working #2807
Comments
|
Hi @zachleat. Thanks for taking the time to look into this. Unfortunately, this isn't solved with Looking into this again, I've found that the following do work:
So it looks like this issue is specific to CSS being inlined. I observed in my first comment that:
Could this be the cause of what I'm seeing? If not, please let me know if there's anything more I can share to help get to the bottom of this. Thanks again for looking into this, and thanks for all your hard work on this excellent project! |
I do think 2.0.1 had a genuine bug with updating layouts. File and fixed #2903, which is shipping with 2.0.2. If you want to test it, you can use |
|
Thanks for taking another look at this. Unfortunately when using |
I have this issue on Windows, but it's not just inlined CSS. The only thing that fixed it for me was bypassing the bundle plugin plugin and including CSS from the public folder with a |
Operating system
Debian 11, running under WSL 2 on Windows 11 Pro (22H2)
Eleventy
2.0.0
Describe the bug
I'm struggling to get hot reloading of inlined CSS to work. I've got a minimal reproduction of the issue I'm seeing below. In this setup, I can see that changes to CSS files trigger a rebuild, but I don't see my CSS changes taking effect in the browser following the rebuild.
Reproduction steps
These steps are a remix of the getting started guide and Inline Minified CSS quick tip.
mkdir hot-reload-repro
cd hot-reload-repro
npm init -y
npm install --save-dev @11ty/eleventy clean-css
Add the following layout as
_includes/base.njk
:Add the following, gorgeous, CSS as
assets/css/inline.css
:Add the following content as
index.md
:Add the following eleventy configuration as
eleventy.config.js
:Run Eleventy and watch for changes:
npx @11ty/eleventy --serve
Expected behavior
I would expect that making changes to CSS files would trigger a reload, and the updated stlyes to be visible in the browser without needing to refresh the browser.
Following the reproduction steps, above, making a change to the CSS file, e.g. changing the
background-color
, doesn't apply the updated styles. I don't think this is expected, as I've told Eleventy to watch for changes to CSS files usingeleventyConfig.addWatchTarget("**/*.css")
.I do see a message like:
in the browser console, but the page CSS doesn't actually update1.
It's worth nothing that everything seems to work fine if my CSS files live under the
_includes
directory. I think because changes to includes and layouts cause a full reload.Reproduction URL
No response
Screenshots
No response
Footnotes
It looks like the
eleventy-dev-server
script has special handling of changed CSS files. I assume that because my CSS changes are inlined, and in the head of the document, the reload client isn't applying the change. However, this is just a guess and might be wildly off the mark. ↩The text was updated successfully, but these errors were encountered: