Coder Social home page Coder Social logo

www-os's Introduction

www-os

a one-file "spa" for static sites. think you need react, svelte, vue, turbo, pjax, whatever? think again.

copy this one file, it's not perfect, it certainly has some bugs, it's definitely missing features, into your project and modify it as you see fit. now your static site is "single page".

installation

copy this file into your project and load it like:

<script type="module" src="os.js"></script>

usage

create a template for your pages where all the page content is in an element with a consistent id, like:

<head>
  <script type="module" src="os/os.js"></script>
</head>

<body>
  <!-- the page content -->
  <div id="page">this will change if click a link</div>
  
  <!-- the persistent content -->
  <div id="persistent">this will not</div>
</body>

as long as the string on this line matches the id of the element w/ your page content, you're good.

const kId = {
  Page: "page",
}

how it works

every time you click a link, the contents of the element w/ the id page element (in our example) will be replaced with whatever is in the new page's page element. nothing else, like the persistent element, will change (e.g. you can put audio elements in there that live across multiple pages).

similarly, everything outside the new page's page element is ignored (though this is a bug or a few).

is this for me?

if you already know the answer, no need to read further.

do you want to avoid learning a bunch of complicated stuff that will make your life harder? that will make your site slower? harder to maintain?

do you need a piece of technology at all? does your site really need a backend? if it can be powered by a cms, the answer is no. could you isolate the part of the site that needs a backend into a much smaller service?

if answering any of these questions made you twink twice about technology decisions, then this library may be for you.

todos

www-os's People

Contributors

tycobbb avatar

Stargazers

 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.