Package Exports
- @stackpress/ink-dev
- @stackpress/ink-dev/client.js
- @stackpress/ink-dev/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stackpress/ink-dev) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
💧 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);