limited-teacher-83117
02/10/2023, 8:19 PMlimited-teacher-83117
02/10/2023, 8:22 PMhx-trigger
syntax is so good it makes me wonder whether there could be an attribute executes some client-side js/hyperscript in place of the typical hx-get
, hx-put
network call
hx-trigger="load delay:2s" hx-execute="() => this.innerText = 'Save'"
to avoid the round trip while still staying roughly within the HTMX paradigmgorgeous-airport-54386
02/10/2023, 8:23 PMhx-get="javascript:this.innerText = 'Save'"
(doesn't currently work)mysterious-toddler-20573
02/10/2023, 8:26 PMechoing-dress-67727
02/10/2023, 8:35 PMechoing-dress-67727
02/10/2023, 8:36 PMechoing-dress-67727
02/10/2023, 8:37 PMvar exports={}
I have no idea where that comes from thoughechoing-dress-67727
02/10/2023, 8:38 PMimport htmx from "htmx.org"
it sets htmx
to {}
instead of having ajax
, etc defined in thereechoing-dress-67727
02/10/2023, 8:42 PMimport htmx from "htmx.org"
in the npm/webpack ecosystem. From what I can see in here: https://raw.githubusercontent.com/bigskysoftware/htmx/master/dist/htmx.min.js there's no exportsechoing-dress-67727
02/10/2023, 8:50 PMechoing-dress-67727
02/10/2023, 8:50 PMmysterious-toddler-20573
02/10/2023, 8:53 PMechoing-dress-67727
02/10/2023, 8:58 PMechoing-dress-67727
02/10/2023, 8:58 PMechoing-dress-67727
02/10/2023, 8:58 PMechoing-dress-67727
02/10/2023, 8:59 PMechoing-dress-67727
02/10/2023, 9:00 PM<script type="importmap">
{
"imports": {
"square": "./module/shapes/square.js",
"circle": "https://example.com/shapes/circle.js"
}
}
</script>
And then in you JS, you can do
import square from "square"
import circle from "circle"
and it'll work. No bundling needed.echoing-dress-67727
02/10/2023, 9:01 PMimport circle from "https://example.com/shapes/circle.js"
But the problem is that's not caching-friendly basically. You want to be able to add a digest/fingerprint to that url name. importmap lets you do that, without having to go changing imports all over the placeechoing-dress-67727
02/10/2023, 9:07 PMechoing-dress-67727
02/10/2023, 9:12 PMechoing-dress-67727
02/10/2023, 9:12 PMmysterious-toddler-20573
02/10/2023, 9:16 PMechoing-dress-67727
02/10/2023, 9:19 PMmysterious-toddler-20573
02/10/2023, 9:30 PMgreat-gold-37694
02/10/2023, 10:36 PMgreat-gold-37694
02/10/2023, 10:37 PMmysterious-toddler-20573
02/10/2023, 11:05 PMicy-motherboard-95213
02/11/2023, 12:08 AMicy-motherboard-95213
02/11/2023, 1:12 AMechoing-dress-67727
02/11/2023, 5:28 AM