Skip to content

live reload on @import css file #63

@julientaq

Description

@julientaq

hi there.

i’m using eleventy 2.0 and my folder with the simplest setup for css file: a css folder that contains a main.css filled like this

@import url("./modules/fonts.css");
@import url("./modules/variables.css");
@import url("./modules/texts.css");
@import url("./modules/images.css");
@import url("./modules/tables.css");

When i’m updating my main.css file, i get a perfect blazing fast (amazing work btw) live reload.

But if i update one of the css file imported in main.css, the console tell me that the live reload worked, but the styles are not updated until i reload the page.

I looked a bit at the code, and it seems that this line of code is the one doing the work.

for (let link of document.querySelectorAll(`link[rel="stylesheet"]`)) {

From what i understand here, the css update of the page is done by updating the url to the main file, but it doesn’t account for the imported files that this one may contain.

If i try to save the main.css after updating the imported file, the live reload doesn’t work either so i guess it has to do with how the server look at the imported css files, if it looks at those.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions