zitjs
TypeScript icon, indicating that this package has built-in type declarations

1.1.0-beta.5 • Public • Published

zit.js

web framework working with vanilla javascript

🦄 npm 📃 github 📜 docs

📦 Install

npm install --save-dev zit
yarn add -D zit
// esm (browser)
import * as zit from 'zitjs';
// cjs (server)
const zit = require('zitjs');

🚀 Usage

const foobar = zit.createElement('h1', 'foo bar');
const app = zit.html`${foobar}`;

console.log(app);
/*
<h1>foo bar</h1> 
*/
const greet = zit.createElement('h1', 'hello {{name}}', { name: 'default name' });
const app = zit.html`${greet({ name: 'world' })}`;

console.log(app);
/*
<h1>hello world</h1>
*/

🛠️ Router

const userPage = zit.createElement("div", "{{user}}'s page")

zit.useRouter({
  {
    '/': { template: "<div>Main Page</div>" },
    "/users/:user": { template: userPage } // use params
  }
}, document.getElementById('app'));

License

MIT

Package Sidebar

Install

npm i zitjs

Weekly Downloads

2

Version

1.1.0-beta.5

License

MIT

Unpacked Size

67.2 kB

Total Files

7

Last publish

Collaborators

  • do4ng