0.4.6 • Published 4 months ago

@stackpress/ink-dev v0.4.6

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

💧 Ink DEV

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

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

Install

$ npm -i @stackpress/ink-dev

Usage

import http from 'http';
import ink from '@stackpress/ink/compiler';
import { dev } from '@stackpress/ink-dev';

//create ink compiler
const compiler = ink({ 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.ink'));
    //compile the document
    const html = await compiler.render('./page.ink');
    //... send response ...
  }
  //... other routes ...
});
//listen on port 3000
server.listen(3000);
0.3.31

4 months ago

0.3.30

4 months ago

0.3.36

4 months ago

0.3.34

4 months ago

0.3.33

4 months ago

0.3.32

4 months ago

0.3.29

4 months ago

0.3.28

5 months ago

0.3.27

5 months ago

0.3.26

5 months ago

0.3.25

5 months ago

0.3.24

5 months ago

0.3.23

5 months ago

0.2.10

7 months ago

0.3.21

5 months ago

0.3.6

7 months ago

0.3.17

6 months ago

0.3.16

6 months ago

0.3.15

6 months ago

0.3.14

6 months ago

0.3.12

6 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.1.20

8 months ago

0.1.21

8 months ago

0.1.22

8 months ago

0.1.23

8 months ago

0.1.25

8 months ago

0.1.26

8 months ago

0.4.5

4 months ago

0.2.7

7 months ago

0.4.4

4 months ago

0.2.6

7 months ago

0.4.6

4 months ago

0.4.1

4 months ago

0.4.3

4 months ago

0.2.5

7 months ago

0.4.2

4 months ago

0.1.19

8 months ago

0.1.18

8 months ago

0.1.14

8 months ago

0.1.15

8 months ago

0.1.16

8 months ago

0.1.17

8 months ago

0.1.12

8 months ago

0.1.11

9 months ago

0.1.10

9 months ago

0.1.9

9 months ago

0.1.8

9 months ago