gemini-2.5-flash| input-price: 0.3 output-price: 2.5 max-context-length: 128_000 (cost: $0.005) Β· Anfrage: 2025-09-23T19:03:09.529126
Generated by rs-summarizer Version unbekannt
Abstract:
This video demonstrates how to build dynamic web pages with partial reloads using Common Lisp, leveraging the HTMX JavaScript library for declarative AJAX requests. It showcases the integration of HTMX with a Common Lisp web server (using Neagle for routing and Spinneret for HTML generation) to create an example application where users can add books to a list without requiring a full page refresh. The tutorial covers setting up the server, defining the page structure, handling data storage, rendering components, and configuring HTMX attributes for form submission and targeted content replacement, including a small JavaScript snippet for post-request cleanup.
Exploring Dynamic Web Pages with Common Lisp and HTMX
Neagle for routing (built on Clack and Spin) and Spinneret for HTML generation. The approach doesn't require additional front-end libraries beyond HTMX.<head> includes imports for HTMX and Bulma CSS, while the page <body> content is provided by the macro user.<body> is designed to contain a form for adding new books and a div to display a list of all books. Initially, books are stored in a simple Common Lisp list.book-component function is created to dynamically render the books list as an unordered HTML list. The div containing this list is given the id="book-list", which is crucial for HTMX to target updates.data-hx-get="/add-book" specifies the AJAX request URL, and hx-target="#book-list" instructs HTMX to replace the content of the #book-list element with the server's response./add-book Route: A new server-side route, /add-book, is defined. This route processes the submitted book name, adds it to the global books list, and then re-renders only the book-component's HTML to be sent back as the AJAX response.hx:after-request event and resets the input's value.