{"by":"josephernest","descendants":45,"id":35991783,"kids":[36008341,36011645,36010737,36008182,36008516,36016544,36010001,36009348,36010218,36008794,36010109,36010130,36009882,36011405,36010446,36008214,36016714,36013077,36009122,35992266,36009499],"score":127,"text":"Hi HN! I created this lib in the need of a simple and tiny framework to easily do AJAX-style navigation &#x2F; replacement of fragments in the page, in a web application.<p>For people who don&#x27;t want to use client-side-rendering and complex frameworks à la React, there are nowadays a few &quot;HTML-over-the-wire&quot; libraries, like HTMX, Unpoly or this super-tiny one Swap.js :)<p>One other key thing is that no external tool is needed: no bundler, no webpack, no TypeScript compiler, no minification needed. Just write HTML, JS (+ your preferred server-side language: PHP, Python, etc.) and it works.<p>The framework makes use of fetch (of course) but also MutationObserver API to be able to launch actions when parts of the DOM change.<p>Let me know what you think!","time":1684433051,"title":"Show HN: Swap.js – a JavaScript micro-framework (HTML fragments over the wire)","type":"story","url":"https://github.com/josephernest/Swap"}