@imported stylesheets reloaded relative to html document not relative to parent stylesheet, resulting in 404

Open
#248 0 comments 0 reactions 0 assignees View on GitHub

@jihtsan is already working on this.

Since Oct 27, 2026.

  • #298 by @jihtsan — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
devtools, web-dev

Research direction

Start with the reproduction using index.html, css/style.css, and css/import.css, then trace how Server.watch and serve handle the imported stylesheet. Verify the reload request preserves the parent stylesheet's css/ path, and confirm touching css/import.css no longer requests /import.css.

Written by the indexing model from the issue text.

Description

$ cat index.html 
<!DOCTYPE html>
<html><head><link rel="stylesheet" href="css/style.css" type="text/css"></head><body></body></html>

$ cat css/style.css 
@import url("import.css")

$ cat css/import.css 
/* imported */

$ python3 -c 'from livereload import Server, shell; server = Server(); server.watch("."); server.serve();'
[I 210604 10:20:55 server:335] Serving on http://127.0.0.1:5500

When I now do touch css/import.css, livereload attempts to reload /import.css?livereload=1622798509993 instead of /css/import.css?livereload=1622798509993.

Dominant language
Python
Stars
1.1k
Forks
149
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lepture/python-livereload

All issues in lepture/python-livereload

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.