Update ViewEngine README with htmax info
This commit is contained in:
@@ -13,7 +13,8 @@ _Several constructs have been marked obsolete in this release, and will be remov
|
||||
### Setup
|
||||
|
||||
1. Install the package.
|
||||
2. Prior to using the attribute or support modules, `open Giraffe.ViewEngine.Htmx`.
|
||||
1. Prior to using the attribute or support modules, `open Giraffe.ViewEngine.Htmx`.
|
||||
1. If the client is using the `htmax` bundle, also `open Giraffe.ViewEngins.Htmax`.
|
||||
|
||||
### Use
|
||||
|
||||
@@ -34,7 +35,7 @@ Support modules include:
|
||||
- `HxTrigger`
|
||||
- `HxVals`
|
||||
|
||||
`Htmx.Script.local` creates an `XmlNode` to load the package-provided htmx library. There are also two `XmlNode`s that will load the htmx script from jsdelivr; `Htmx.Script.cdnMinified` loads the minified version, and `Htmx.Script.cdnUnminified` loads the unminified version (useful for debugging). htmx v4 also distributes a "max" bundle which contains some common extensions; these are available as `Htmx.Script.localMax`, `Htmx.Script.cdnMaxMinified`, and `Htmx.Script.cdnMaxUnminified`.
|
||||
`Htmx.Script.local` creates an `XmlNode` to load the package-provided htmx library. There are also two `XmlNode`s that will load the htmx script from jsdelivr; `Htmx.Script.cdnMinified` loads the minified version, and `Htmx.Script.cdnUnminified` loads the unminified version (useful for debugging). htmx v4 also distributes a "max" bundle which contains some common extensions; these are available with the same names under `Htmx.Script.Max`.
|
||||
|
||||
_NOTE: When using the CDN nodes and a Content Security Policy (CSP) header, `cdn.jsdelivr.net` needs to be listed as an allowable `script-src`._
|
||||
|
||||
@@ -49,10 +50,10 @@ htmx's attributes and these attribute functions map one-to-one. There are two ex
|
||||
The htmx `hx-on` attribute supports multiple events if they are separated with a newline (`\n`) character. The value provided to this attribute will be attribute-escaped, but in testing, it was interpreted correctly.
|
||||
|
||||
The support modules contain named properties for known values (as illustrated with `HxTrigger.Load` above). A few of the modules are more than collections of names, though:
|
||||
- `HxRequest` has a `Configure` function, which takes a list of strings; the other functions in the module allow for configuring the request.
|
||||
- `HxConfig` has a `Configure` function, which takes a list of strings; the other functions in the module allow for configuring the request.
|
||||
|
||||
```fsharp
|
||||
HxRequest.Configure [ HxRequest.Timeout 500 ] |> _hxRequest
|
||||
HxConfig.Configure [ HxRequest.Timeout 500 ] |> _hxConfig
|
||||
```
|
||||
- `HxTrigger` is _(by far)_ the most complex of these modules. Most uses won't need that complexity; however, complex triggers can be defined by piping into or composing with other functions. For example, to define an event that responds to a shift-click anywhere on the document, with a delay of 3 seconds before firing:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user