Create a file with the html contents using the fs module:
var fs = require('fs')var createHTML = require('create-html')var html = createHTML({ title: 'example'})fs.writeFile('index.html', html, function (err) { if (err) console.log(err)})
Create a stream by pairing this module with from2-string:
var fromString = require('from2-string')var createHTML = require('create-html')var html = createHTML({ title: 'example'})var stream = fromString(html)stream.pipe(process.stdout)
Pipe content into the html that this module generates by using from2-string and hyperstream
This module comes with a simple command-line tool for creating html files.
Install it globally with npm i -g create-html
Usage:
Usage: create-html [options]Options: --title, -t Page title --script, -s JavaScript filename, optional --script-async, -a Add async attribute to script tag --css, -c CSS filename, optional --favicon, -f Site favicon --lang, -l Language of content --dir, -d Direction of content --head, -H Content to insert into <head> tag --body, -b Content to insert into <body> tag --output, -o File name. optional. default: stdout --help, -h Show this help message