nrdvana / perl-App-SlideServer

Serve HTML slides and synchronize clients via websocket
3 stars 0 forks source link

Localized <style> tags for slides #4

Open nrdvana opened 12 months ago

nrdvana commented 12 months ago

If a slide begins and then contains a <style> tag, that style tag should be scoped to only affect the current slide. It should also probably be inlined into the HTML elements so that reloads of that slide bring the new styles.

CSS::Scopifier and CSS::Inliner can do this, but that adds a lot of dependencies...

nrdvana commented 12 months ago

Each slide could be given a truncated SHA1 as its ID, so the styles would refer to #abcdef12345 and then after a change, a new slide with new ID would be transferred, and new css rules would not interfere with old css rules. The css rules would eventually pile up in the browser after lots of changes, but then the user could just reload the page if needed.

This might further benefit if the back end and front end exchange lists of which hashes they have and which hashes they need, kind of like rsync. This way insertion or deletion of a slide doesn't need to re-send all the slides following that point.

nrdvana commented 1 week ago

The javascript server Vite performs hot-reloads of portions of pages using a <tag data-v-ddf60120=""> and then css rules begin with tag[data-v-299dcc96] ...

This prevents relying on global IDs