simplesinglepage

1.0.2 • Public • Published

simplesinglepage

simplesinglepage can create simple single page apps. You just have to do the following:

route("contact", document.getElementById("contactFormTemplate").innerHTML); // you can have multiple routes; the second argument is a string; the second argument is everything inside <html>

and for the HTML:

<template id="contactFormTemplate">
  <h1>Contact</h1>
  <form action="mailto:example@example.com">
    <input type="text" name="subject" />
    <br />
    <textarea name="body"></textarea>
  </form>
</template>
<a href="?contact">Contact Us</a>
<!-- You can have extra GET paramaters -->

Although we're using GET paramaters, no server is required (other than your static server), because it uses URLSearchParams and window.location.search, and both are only available client side.

Originally, I wanted to use a #, but those are hard to work with, so I'm using a query paramater because it's easier to develop with.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.20latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i simplesinglepage

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

2.88 kB

Total Files

5

Last publish

Collaborators

  • brahmasharma