How to sync updated css external file?

I’m using an external css file for my cards. I put the file _style.css in the folder and include in the style section of the various note types card templates @import url("_style.css")

As far as I can see, anki doesn’t notice when this file in the dir changes and therefore doesn’t update it, even if I check media before syncing.

So how do I update my css changes to my other devices when I change the css on my pc?

I saw that @glutanimate years ago used an add-on to this purpose (anki 2.0). I also noted Anki many times recognizes a change in media folder, but not always.

Can someone offer me any help?

1 Like

Thanks Damien.

I’ll register a workaround I found, in case someone feel this need.

I renamed the css file; checked media; synchronized; renamed back the css file to the original name; checked media again; synchronized again. This forced the upload of the new version of the file to the server, spreading it to my other devices.

1 Like

You can also just to a pseudo-image in some note’s field: <!--<img src="_the.css">-->

I wasn’t able to reproduce this. Even using the pseudo-image in a note field, the changed version of the css file was not updated to the server unless I renamed it, checked media, renamed back and checked media again.

That’s… weird, sorry. Then again all it really does is make Anki definitely aware of the file. An file update is only triggered when the timestamp on it changes (which, like the manual hits at, may not be recognized on filesystems like fat32). IIRC some editors have an option that saves a file with its old timestams, maybe it’s that?

Simply adding, removing or renaming a file in the media folder should be enough. You may also need to restart your other clients if they are caching a resource in webview memory.

Thanks a lot.