Liking cljdoc? Tell your friends :D

ring.hot-reload.inject

HTML response detection and script injection.

HTML response detection and script injection.
raw docstring

full-html-page?clj

(full-html-page? body)

Returns true if the string body contains an <html tag, indicating a full HTML document rather than a partial/fragment (e.g. htmx or datastar response).

Returns true if the string body contains an <html tag, indicating a full
HTML document rather than a partial/fragment (e.g. htmx or datastar response).
sourceraw docstring

html-response?clj

(html-response? {:keys [headers]})

Returns true if the response has a text/html content type.

Returns true if the response has a text/html content type.
sourceraw docstring

inject-into-responseclj

(inject-into-response response script)

If the response is a full HTML page with a string body, injects the script. Partial HTML fragments (e.g. htmx/datastar responses) are left untouched. Returns the modified response, or the original if not applicable.

If the response is a full HTML page with a string body, injects the script.
Partial HTML fragments (e.g. htmx/datastar responses) are left untouched.
Returns the modified response, or the original if not applicable.
sourceraw docstring

inject-scriptclj

(inject-script body script)

Injects a <script> tag into an HTML response body string. Inserts before </body> if present, otherwise appends to end.

Injects a <script> tag into an HTML response body string.
Inserts before </body> if present, otherwise appends to end.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close