0.1.7 • Published 10 months ago

@ossph/temple-dev v0.1.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

⛩️ Temple DEV

This package is designed for Temple, the reactive web component template engine. See docs for more information.

Temple developer mode with hot page reload. Not suited for production environments.

Install

$ npm -i @ossph/temple-dev

Usage

import http from 'http';
import temple from '@ossph/temple/compiler';
import { dev } from '@ossph/temple-dev';

//create temple compiler
const compiler = temple({ cwd: __dirname });
//1. create dev tools
const { router, refresh } = dev({ cwd: __dirname });

//create http server
const server = http.createServer(async (req, res) => {
  //2. Add dev router
  if (router(req, res)) return;
  //if home page
  if (req.url === '/') {
    //3. sync builder with refresh server
    refresh.sync(compiler.fromSource('./page.dtml'));
    //compile the document
    const html = await compiler.render('./page.dtml');
    //... send response ...
  }
  //... other routes ...
});
//listen on port 3000
server.listen(3000);
0.1.7

10 months ago

0.1.6

10 months ago

0.1.4

10 months ago

0.1.5

10 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.0

11 months ago

0.1.1

11 months ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago