-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ernestmarcinko/dev
chore: added htmx-serverless
- Loading branch information
Showing
13 changed files
with
134 additions
and
12 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import htmx from "htmx.org"; | ||
import htmxServerless from "htmx-serverless"; | ||
|
||
htmxServerless.init(htmx); | ||
|
||
htmxServerless.handlers.set('/clicked', | ||
`<button hx-get="/clicked2" hx-swap="outerHTML" hx-ext="serverless"> | ||
Hey! | ||
</button>` | ||
); | ||
htmxServerless.handlers.set('/clicked2', | ||
`<button hx-get="/clicked3" hx-swap="outerHTML" hx-ext="serverless"> | ||
Okay then! | ||
</button>` | ||
); | ||
htmxServerless.handlers.set('/clicked3', | ||
`<button hx-get="/clicked4" hx-swap="outerHTML" hx-ext="serverless"> | ||
Stop it now. | ||
</button>` | ||
); | ||
htmxServerless.handlers.set('/clicked4', | ||
`<button hx-get="/clicked5" hx-swap="outerHTML" hx-ext="serverless"> | ||
Just stop pls.. | ||
</button>` | ||
); | ||
htmxServerless.handlers.set('/clicked5', | ||
`<button hx-get="/clicked6" hx-swap="outerHTML" hx-ext="serverless"> | ||
Sus. | ||
</button>` | ||
); | ||
htmxServerless.handlers.set('/clicked6', | ||
`<button hx-get="/clicked" hx-swap="outerHTML" hx-ext="serverless"> | ||
I'm done. | ||
</button>` | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<%- include('../parts/head'); %> | ||
<script src="/dist/htmx-serverless.js"></script> | ||
</head> | ||
<body> | ||
<main class="wrapper" role="main"> | ||
<section class="intro htmx-serverless"> | ||
<h1 id="tw1">HTMX Serverless</h1> | ||
<p> | ||
<h3>Click the button to do things</h3> | ||
<button hx-get="/clicked" hx-swap="outerHTML" hx-ext="serverless"> | ||
Click to change the buttons! | ||
</button> | ||
<p>The button changes via HTMX without server queries.</p> | ||
<p><a href='https://github.com/ernestmarcinko/htmx-serverless'>Github repository</a> | <a href="https://www.npmjs.com/package/htmx-serverless">npm</a></p> | ||
|
||
</p> | ||
</section> | ||
<section style="max-width: 640px;"> | ||
<h2>HTMX boosted</h2> | ||
<p> | ||
HTMX without a server? Yes, it is possible! Although HTMX is designed focusing on server-client connections, | ||
in some cases it is convenient to define static responses to certain requests. | ||
</p> | ||
<p> | ||
This is what the <a href="https://github.com/ernestmarcinko/htmx-serverless">htmx-serverless</a> library can do. | ||
</p> | ||
<p><a href='../'><< Back Home</a></p> | ||
</section> | ||
</main> | ||
|
||
<%- include('../parts/footer'); %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.