Skip to content
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

CSS changes are not reflected in the browser without a manual refresh #30

Open
scottsweb opened this issue Jan 7, 2025 · 0 comments
Open

Comments

@scottsweb
Copy link

scottsweb commented Jan 7, 2025

The issue

When using 11ty bundle to create bundles of CSS, the live reload functionality of 11ty breaks. Editing the CSS triggers a rebuild as expected, but the changes cannot be seen in the browser until you manually refresh the page.

This is the console log from testing eleventy-base-blog:

npm run start

> [email protected] start
> npx @11ty/eleventy --serve --quiet

(node:15855) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[11ty] Copied 5 Wrote 16 files in 0.36 seconds (v3.0.0)
[11ty] Watching…
[11ty] Server at http://localhost:8080/
[11ty] File changed: public/css/index.css
[11ty] Copied 5 Wrote 16 files in 0.18 seconds (v3.0.0)

I believe this issue extends beyond the base blog though, it is currently impacting my starter theme and this PR in which I hope to use bundles. I have also found other folks discussing similar things:

Things I have tried

{%- if eleventy.env.runMode === "serve" -%}
	<link rel="stylesheet" href="{% getBundleFileUrl 'css' %}">
{%- else -%}
	<style>{% getBundle 'css' %}</style>
{%- endif %}

This doesn't seem to help and results in many CSS bundles appearing in the output folder:

-rw-r--r--. 1 scott scott 13391 Nov 14 15:32 vxgdJLPMXh.css
-rw-r--r--. 1 scott scott  3726 Nov 14 15:32 WlTt7eHx1R.css
-rw-r--r--. 1 scott scott  3551 Jan  7 12:24 ZAQZGhTPjt.css
-rw-r--r--. 1 scott scott 11575 Nov 12 22:14 zFpR6RP7xC.css

My system

OS: Fedora Linux 41
Node: v22.11.0
Browsers: Firefox, Chrome

I'll keep poking things in the hope of a solution but let me know if there is anything I should be looking out for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant