Giter Site home page Giter Site logo

dashpilot / vanilla-spa Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 43 KB

Simple single-page app written in vanilla js

Home Page: https://vanilla-spa-wine.vercel.app/

JavaScript 45.82% CSS 6.57% HTML 47.61%
simple spa single-page-app vanilla-js vanilla-javascript handlebars no-build

vanilla-spa's Introduction

Vanilla SPA

Simple single-page app written in vanilla js. It uses Handlebars for templating and Navigo for routing.

About

Tired of compilers, build-scripts, dependancy hell and npm audit fix? This refreshingly simple Single Page App (SPA) has no shadow dom or build pipelines and does just enough to be useful.

Vanilla SPA also runs in environments that do not support Nodejs such as Object Storage or shared hosting and can be edited on the fly without waiting for a compiler or a build pipeline.

Demo

https://vanilla-spa-wine.vercel.app/

History.pushState() Routing

Vanilla SPA supports history.pushState() routing, which gives you clean URLs (no #hash). Another advantage is that you can prerender you pages via a service like https://prerender.com, effectively turning you SPA into a static site!

For history.pushState() to work, you need to redirect all requests to index.html. Below are some examples on how to configure this on different platforms:

http-server (for local testing)

http-server --port 8080 -P http://localhost:8080?

Vercel

Add a vercel.json file with the following contents:

{
  "routes": [{
      "handle": "filesystem"
    },
    {
      "src": "/.*",
      "dest": "/index.html"
    }
  ]
}

More info: https://vercel.com/docs/configuration#routes

Netlify

Add a _redirects file containing the following:

/*    /index.html   200

More info: https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps

Apache

Create a .htaccess file containing the following:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js)$
RewriteRule .* /index.html [L,R=302]

vanilla-spa's People

Contributors

dashpilot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.