Sladniebieskiego (talk | contribs) Submitting using AfC-submit-wizard |
Sohom Datta (talk | contribs) →Key differentiators from JavaScript frameworks: that is marketing |
||
Line 45: | Line 45: | ||
The library's design philosophy revolves around simplicity and the power of hypertext. By leveraging HTML attributes, HTMX enables developers to define dynamic behavior directly within their markup, reducing the need for extensive JavaScript code. This approach offers a more accessible and intuitive way to build modern user interfaces while avoiding the complexities often associated with traditional JavaScript frameworks.<ref>{{Cite web |title=htmx ~ Essays |url=https://htmx.org/essays/ |access-date=2024-04-30 |website=htmx.org}}</ref> |
The library's design philosophy revolves around simplicity and the power of hypertext. By leveraging HTML attributes, HTMX enables developers to define dynamic behavior directly within their markup, reducing the need for extensive JavaScript code. This approach offers a more accessible and intuitive way to build modern user interfaces while avoiding the complexities often associated with traditional JavaScript frameworks.<ref>{{Cite web |title=htmx ~ Essays |url=https://htmx.org/essays/ |access-date=2024-04-30 |website=htmx.org}}</ref> |
||
== Key differentiators from JavaScript frameworks == |
|||
In comparison to JavaScript frameworks like [[React (software)|React]] and [[Vue.js]], which create [[Single-page application|single-page applications]] (SPAs) by making server requests using JavaScript and processing data using the [[JSON]] (JavaScript Object Notation) data format, HTMX takes a different approach. HTMX allows developers to issue AJAX requests directly from the HTML itself, utilizing a variety of events to trigger these requests. |
|||
The four basic issues HTMX aims to address with traditional HTML are:<ref>https://htmx.org/</ref> |
|||
# Limited elements for HTTP requests: HTMX removes the constraints that limit HTTP requests to <code><a></code> and <code><form></code> elements, allowing other HTML elements to perform these requests as well. |
|||
# Limited [[Event (computing)|event triggers]]: HTMX expands the range of events that can trigger HTTP requests beyond just click and submit events. |
|||
# Limited HTTP methods: HTMX provides support for a wide range of HTTP methods beyond just [[GET (HTTP)|GET]] and [[POST (HTTP)|POST]]. It has to be noted, however, that the key limitations HTTP methods impose on implementers are whether the request or a successful response has a body. Even though it can be viewed as [[Idiom (language structure)|unidiomatic]], a POST request can still perform the deletion or updating of resources and if the backend has mechanisms to ensure [[Idempotence|idempotency]], such as a caching [[middleware]], perform the updates idempotently, without the need for DELETE, PATCH or PUT, respectively.<ref>{{Cite web |date=2023-04-10 |title=HTTP request methods - HTTP {{!}} MDN |url=https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods |access-date=2024-04-30 |website=developer.mozilla.org |language=en-US}}</ref> |
|||
# Limited page replacement: HTMX allows developers to update specific parts of a page dynamically instead of requiring the entire page to be replaced, especially when an update is not achievable using [[Pseudo-class|CSS pseudo-classes]] without resorting to ''explicit'' client-side JavaScript. |
|||
By removing these constraints, HTMX allows utilizing HTML '''syntax''' to build feature-rich user interfaces. It has to be noted however, that even though it can greatly reduce the amount of JavaScript code ''written'' it cannot add functionality beyond what plain HTML and CSS with server-side scripting would be capable of, without requiring the clients to use at least some Javascript. This is because HTML and CSS capabilities are constrained by the browsers and their [[Browser engine|layout engines]] – otherwise there would be no need for [[Polyfill (programming)|polyfills]] or standardization as client-side/server-side-rendered code would be capable of freely extending the standard specification without the need for Javascript. |
|||
== Integration and compatibility == |
== Integration and compatibility == |
Revision as of 04:41, 30 April 2024
- Comment: This might be barely notable, but the article needs to be completely rewritten to Wikipedia's standards to make it through AFC. Remove all references that are blogs and make sure the article sounds like a encyclopedia entry and not a brochure on why I should use HTMX. Sohom (talk) 23:04, 7 April 2024 (UTC)
- Comment: Additional references from independent and reliable sources are essential to demonstrate notability. Hitro talk 09:56, 27 January 2024 (UTC)
- Comment: Please make sure to include WP:INCITE and also use secondary reliable sources. CNMall41 (talk) 21:03, 21 January 2024 (UTC)
HTMX is an open-source.[1] JavaScript library for web development that aims to combine the approach of server-side rendered, templated web pages with the dynamic and interactive features that many JavaScript frameworks offer by enabling AJAX directly in HTML, utilizing hypermedia-driven approach and extending the standard HTML syntax with it's own attributes.[2][3][4]
Original author(s) | Carson Gross |
---|---|
Initial release | November 24, 2020[5] |
Stable release | 1.9.12[6]
/ 26 April 2024 |
Written in | JavaScript |
Size | 15.7 KB min+gzip[7] |
Type | JavaScript library |
License | BSD 0-clause[8] |
History
HTMX has its roots in intercooler.js, a frontend library created by Carson Gross in 2013. The library aimed to address the complexity associated with AJAX (Asynchronous JavaScript and XML) by introducing a simplified approach using HTML attributes.[9]
The intent was to create a framework that was aligned with Roy Fielding's original intent for REST (REpresentational State Transfer) - and specifically HATEOAS (Hypermedia As The Engine Of Application State). The problem is described in Fielding's blog post "REST APIs must be hypertext-driven" from October 2008.[10]
Gross continued to refine and improve intercooler.js, and eventually, it evolved into HTMX. The release of HTMX was a remarkable milestone for the project, by offering a way to utilize AJAX, CSS transitions, WebSockets, and Server-Sent Events directly in HTML using attributes.
Design and functionality
HTMX enhances HTML elements for creating interactive web applications with a focus on simplicity and leveraging hypertext capabilities. It allows developers to easily add dynamic behavior to their markup using HTML attributes, reducing or even eliminating the need for extensive JavaScript code with large bundles,[11] complex state management or hydration. HTMX can also update specific parts of a webpage without the need to reload the entire page (as would be the case with plain HTML+CSS), which might result in improved user experience and performance, since only a part of the data needs to be re-fetched from the server.[12]
It also challenges the common approach of utilizing JSON as the standard payload for HTTP requests and replacing it with HTML. This is meant to solve the issues related to the performance and cognitive overhead of JSON (de)serialization and subsequent use in the user interface, such as JavaScript and JSON's inability to accurately process numbers greater than 253 or distinguish floating-point numbers from integers and the complexity involved with alternatives to JSON-oriented REST, such as GraphQL or GRPC.[13] Additionally, a potential advantage of HTMX and hypertext-oriented approach in general, is that data retrieved directly from the database does not need to either be in a JSON or JSON-compliant format, such as that used by many document databases or the PostgreSQL's JSON type, or be serialized by the backend only to be then deserialized by the frontend again.[14] The reduced client-side computation also helps to shift the development focus towards the backend, which might result in better client-side performance (albeit at a cost of higher server load) and providing the developers with a simpler way to solve more problems which they would otherwise solve using client-side JavaScript in virtually any other programming language.[15] For instance, if JSON.stringify()
is not called on nested nested parts of a JSON object it will be displayed as [object Object]
.[16]
The library's design philosophy revolves around simplicity and the power of hypertext. By leveraging HTML attributes, HTMX enables developers to define dynamic behavior directly within their markup, reducing the need for extensive JavaScript code. This approach offers a more accessible and intuitive way to build modern user interfaces while avoiding the complexities often associated with traditional JavaScript frameworks.[17]
Integration and compatibility
HTMX is designed to be lightweight and easy to integrate into existing projects, to be installed using either a Content delivery network or a local standalone file placed inside the script
tag, much like CSS-based UI libraries, such as Tailwind. If a CDN is utilized, one needs to keep in mind the privacy, security and performance implications involved.[18]
Alongside regular HTML, HTMX can be also integrated with many HTML templating engines, see Community and adoption.
Community and adoption
Since its inception as intercooler.js and its subsequent evolution into HTMX, the library has gained a significant following within the web development community. With its focus on simplicity and accessibility, HTMX has gained a certain measure of popularity as an alternative to the approach of most JavaScript frameworks for building dynamic web applications.[19][20][21][22][23]
HTMX integrations have been developed for various full-stack/backend web frameworks, programming languages and templating engines, including Django,[24] Twig,[25] Clojure,[26] Tauri,[27] Go,[28][29] or Express.js.[30] Such libraries are usually matter of nothing more than convenience since HTMX's portable and minimalist design allows it to be integrated with virtually any HTML templating engine.[31]
Between October 24 2023 and April 29 2024, htmx.org Npm package averaged between 35,336 and 68,279 weekly downloads. Meanwhile, Svelte has received between roughly 477 thousand and 1.6 million downloads during the same period,[32] Vue.js - up to approximately 4.4 million,[33] while React was downloaded no less than 12 million times in any given week during that time.[34]
Despite the tech media attention and developer community recognition,[35][36][37][38][39] as of April 2024, commercial adoption of HTMX has so far been limited. Some examples of companies using HTMX include Zapier and Djinni, a freelancing website with over 70000 registered users as of April 2024.[40]
Recognition and achievments
In June 2023, HTMX was accepted into the GitHub Accelerator Program[41]. GitHub Accelerator is a selective program, in which in it that particular edition, 20 out of 1,000 applications were accepted and which allowed it to secure $20,000 worth of funding in addition to "guidance and workshops from open source leaders".[42]
HTMX came in second in 2023 JavaScript Rising Stars for Front End frameworks.[43] The website says:
At two htmx is a library that takes a different approach to provide interactivity to HTML pages:
rather than writing several lines of JavaScript code, developers enhance HTML with specific attributes to enable real-time interactivity and dynamic updates.
It was lauded for its small file size and seamless integration with existing server-side frameworks, as it's part of the trend "send HTML over the wire": ask the server to send partial blocks of HTML instead of handling JSON in the client.
JavaScript Rising Stars use the number of stars added on GitHub over the last 12 months to determine which technology is gaining momentum[44]
References
- ^ "Bigskysoftware/HTMX". GitHub.
- ^ Paakkanen, Juho. "Upcoming JavaScript web frameworks and their techniques." (Aalto University, Vantaa, Finland, 2023).
- ^ "Intro to HTMX: Dynamic HTML without JavaScript". 20 September 2023.
- ^ "Introduction to HTMX | refine". 26 October 2023.
- ^ "Release v1.0.0 - HTMX". GitHub.
- ^ "Release v1.9.12 - HTMX". GitHub.
- ^ "htmx.org v1.9.12". Unpkg. Retrieved 2024-04-30.
- ^ "htmx/LICENSE". HTMX. Retrieved 2024-04-30 – via GitHub.
- ^ https://htmx.org/
- ^ "REST APIs must be hypertext-driven » Untangled".
- ^ Sheppard, Dennis (2017), "Leveling Up Your PWA", Beginning Progressive Web App Development, Berkeley, CA: Apress, pp. 243–259, doi:10.1007/978-1-4842-3090-9_12, ISBN 978-1-4842-3089-3, retrieved 2024-04-30
- ^ "htmx ~ Documentation". htmx.org. Retrieved 2024-04-30.
- ^ Kleppmann, Martin (2017-03-01). "Formats for Encoding Data". Designing Data-Intensive Applications (epub) (1st ed.). 1005 Gravenstein Highway North, Sebastopol, CA 95472, United States of America: O’Reilly Media. JSON, XML, and Binary Variants. ISBN 9781491903100.
{{cite book}}
: CS1 maint: date and year (link) CS1 maint: location (link) - ^ Shi, Xuanhua; Zhang, Yipeng; Huang, Hong; Hu, Zhenyu; Jin, Hai; Shen, Huan; Zhou, Yongluan; He, Bingsheng; Li, Ruibo; Zhou, Keyong (2020-04). "Maxson: Reduce Duplicate Parsing Overhead on Raw Data". IEEE: 1621–1632. doi:10.1109/ICDE48307.2020.00144. ISBN 978-1-7281-2903-7.
{{cite journal}}
: Check date values in:|date=
(help); Cite journal requires|journal=
(help) - ^ Eckert, Raphael (2023-03-23). Erstellen eines einfach bedienbaren und einfach implementierbaren UI-Konzepts mit Go und htmx [Creating an easy-to-use and easy-to-implement UI concept with Go and htmx] (PDF) (in German). Heilbronn: Hochschule Heilbronn.
{{cite book}}
: CS1 maint: date and year (link) - ^ Douglas, Ian (2022-03-09). "When and How to Use JSON Serialization in Postman". Postman Blog. Retrieved 2024-04-30.
- ^ "htmx ~ Essays". htmx.org. Retrieved 2024-04-30.
- ^ "Reasons to avoid Javascript CDNs". Wesley Aptekar-Cassels. Retrieved 2024-04-30.
- ^ https://twitter.com/htmx_org
- ^ "What is so great about HTMX?". 13 January 2023.
- ^ "DjangoCon 2022 | from React to HTMX on a real-world SaaS product: We did it, and it's awesome!". YouTube.
- ^ "HTMX, the "Framework Stupid" Gets Dialed up to Eleven!". 18 January 2024.
- ^ "2024 is the year of HTMX". January 2024.
- ^ "Installation - django-htmx 1.17.3 documentation". django-htmx.readthedocs.io. Retrieved 2024-04-30.
- ^ putyourlightson/craft-htmx, PutYourLightsOn, 2024-03-26, retrieved 2024-04-30
- ^ "[ctmx/ctmx "1.4.12"]". Clojars. Retrieved 2024-04-30.
- ^ "tauri-plugin-htmx". npm. 2023-10-21. Retrieved 2024-04-30.
- ^ "htmx package - github.com/donseba/go-htmx - Go Packages". pkg.go.dev. Retrieved 2024-04-30.
- ^ "htmx package - github.com/angelofallars/htmx-go - Go Packages". pkg.go.dev. Retrieved 2024-04-30.
- ^ "express-htmx-components". npm. 2024-03-08. Retrieved 2024-04-30.
- ^ Opitz, Daniel (2023-08-12). "Slim 4 - HTMX Server-side Integration". Daniel Opitz - Blog. Retrieved 2024-04-30.
- ^ "svelte". npm. 2024-04-17. Retrieved 2024-04-30.
- ^ "vue". npm. 2024-04-29. Retrieved 2024-04-30.
- ^ "react". npm. 2024-04-26. Retrieved 2024-04-30.
- ^ "Dynamic Web Apps without JavaScript - HTMX Showcase at DjangoCon and Devoxx".
- ^ "HTMX | Technology Radar".
- ^ "The best open source software of 2023". 24 October 2023.
- ^ "A First Look at HTMX and How it Compares to React".
- ^ "HTMX: HTML Approach to Interactivity in a JavaScript World". 19 January 2022.
- ^ "Websites using Htmx - Wappalyzer". www.wappalyzer.com. Retrieved 2024-04-30.
- ^ https://accelerator.github.com/
- ^ "GitHub Accelerator: Our first cohort and what's next". 12 April 2023.
- ^ "2023 JavaScript Rising Stars".
- ^ "2023 JavaScript Rising Stars".
- "HTMX: HTML Approach to Interactivity in a JavaScript World." The New Stack. Available at: https://thenewstack.io/htmx-html-approach-to-interactivity-in-a-javascript-world/.
- "HTMX - High Power Tools for HTML." HTMX. Available at: https://htmx.org/.