mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-30 06:21:19 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
aaa457c866
24
www/docs.md
24
www/docs.md
@ -39,6 +39,7 @@ customClasses: wide-content
|
||||
* [debugging](#debugging)
|
||||
* [hyperscript](#hyperscript)
|
||||
* [3rd party integration](#3rd-party)
|
||||
* [caching](#caching)
|
||||
* [security](#security)
|
||||
* [configuring](#config)
|
||||
|
||||
@ -1288,6 +1289,29 @@ example uses Alpine's `$watch` function to look for a change of value that would
|
||||
</div>
|
||||
```
|
||||
|
||||
## <a name="caching"></a>[Caching](#caching)
|
||||
|
||||
htmx works with standard [HTTP caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching)
|
||||
mechanisms out of the box.
|
||||
|
||||
If your server adds the
|
||||
[`Last-Modified`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified)
|
||||
HTTP response header to the response for a given URL, the browser will automatically add the
|
||||
[`If-Modified-Since`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since)
|
||||
request HTTP header to the next requests to the same URL. Be mindful that if
|
||||
your server can render different content for the same URL depending on some other
|
||||
headers, you need to use the [`Vary`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#vary)
|
||||
response HTTP header. For example, if your server renders the full HTML when the
|
||||
`HX-Request` header is missing or `false`, and it renders a fragment of that HTML
|
||||
when `HX-Request: true`, you need to add `Vary: HX-Request`. That causes the cache to be
|
||||
keyed based on a composite of the response URL and the `HX-Request` request header —
|
||||
rather than being based just on the response URL.
|
||||
|
||||
htmx also works with [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)
|
||||
as expected. Be mindful that if your server can render different content for the same
|
||||
URL (for example, depending on the value of the `HX-Request` header), the server needs
|
||||
to generate a different `ETag` for each content.
|
||||
|
||||
## <a name="security"></a>[Security](#security)
|
||||
|
||||
htmx allows you to define logic directly in your DOM. This has a number of advantages, the
|
||||
|
@ -14,7 +14,7 @@ title: </> htmx - Essays
|
||||
* [Complexity Budget](/essays/complexity-budget)
|
||||
* [SPA Alternative](/essays/spa-alternative)
|
||||
* [A Response To "Have SPA's Ruined The Web"](/essays/a-response-to-rich-harris)
|
||||
* [Template Fragments](essays/template-fragments/)
|
||||
* [Template Fragments](/essays/template-fragments/)
|
||||
|
||||
|
||||
### Older [intercooler.js](https://intercoolerjs.org) Essays
|
||||
|
@ -144,5 +144,6 @@ Here are some known implementations of the fragment concept:
|
||||
* [jinja2-fragments package](https://github.com/sponsfreixes/jinja2-fragments)
|
||||
* [jinja_partials package](https://github.com/mikeckennedy/jinja_partials) ([discussion](https://github.com/mikeckennedy/jinja_partials/issues/1) on motivation)
|
||||
* [chameleon_partials package](https://github.com/mikeckennedy/chameleon_partials)
|
||||
* [htmlgenerator](https://github.com/basxsoftwareassociation/htmlgenerator)
|
||||
|
||||
Please [let me know](/discord) if you know of others, so I can add them to this list.
|
||||
|
Loading…
x
Reference in New Issue
Block a user