Package Exports
- pull-create-html
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 (pull-create-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pull-create-html
Create an html file from js and css file streams
var pull = require('pull-stream')
var { read, write } = require('pull-files')
var bundle = require('pull-bundle-js')
var html = require('pull-create-html')
pull(
html('app.html', {
title: '',
description: 'My website'
// Others...
js: pull(
read(__dirname + '/lib/index.js'),
bundle([ ...transforms ])
),
css: pull(
read(__dirname + '/style/index.sass'),
sass()
)
}),
write(__dirname + '/out', err => {
// Finished
})
)Install
npm i pull-create-htmlUsage
html(path?, options)
Creates an html file from js and css file streams, with several options configure the boilerplate html
jsa stream of js files which put in<script>cssa stream of css files which get put in<style>langsets the<html lang=...>attribute. Defaults toen-UStitlesets the<title>...</title>elementbodyis a string of HTML to put before where the JS is injected. e.g. a mount element for vdomcharsetsets the<meta charset=...>element. Defaults toutf-8descriptionsets the<meta name='description'>elementkeywordssets the<meta name='keywords'>elementbasesets thefile.baseon the output HTML filescriptAsynclets the JS files load async by setting<script async="true">in the<head>
Files in the js/css stream are concatenated together. Allows streaming a directory of plain css files, for example.
Also see pull-pair for linking separate js/css pipelines:
var js = pair()
var css = pair()
pull(
read(__dirname + '/lib/index.js'),
bundle([ ...transforms ]),
minify(),
js.sink
)
pull(
read(__dirname + '/style/**/*.sass'),
sass(),
minify(),
css.sink
)
pull(
// Create html from the js and css streams
html('foo.html', { title: 'foo', js, css }),
write(__dirname + '/out', err => {
// Finished
})
)Also see
Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)