_hyperscript
_hyperscript copied to clipboard
PROPOSAL: Stylesheets
Can we implement a way to add/remove stylesheets from the DOM? I'm not set on my solution, but here's my first pass:
If we add expression stylesheet (similar to tag, input, or button from #121) that would identify a named stylesheet (either by ID or URL) then we could do something like this:
add stylesheet "/style.css" to the document's header
remove stylesheet "/style.css" from the document's header
-- or even used in expressions
if stylesheet "/style.css" is null then
log "failed to load stylesheet"
end
Bonus points for recognizing that stylesheets should always go in the document header, and simply allowing
add stylesheet "/style.css"
remove stylesheet "/style.css"
Again, this is a hot take on giving hyperscript the ability to manage stylesheets dynamically, and I'm happy to keep looking for better options.