_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

PROPOSAL: Stylesheets

Open benpate opened this issue 4 years ago • 0 comments

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.

benpate avatar Apr 17 '21 19:04 benpate