make-document-html

Makes final document html from named parameters.

npm install make-document-html
20 downloads in the last month

make-document-html Build Status Dependency Status

Makes final document html from named parameters.

Usage

makeHTML = require("make-document-html")
makeHTML(options)

See example below for most supported options. Also supported: jsPaths, cssPaths, cssCode, body (raw html).

webApp adds a bunch of tags at once. They may become configurable one-by-one later.

Doctype is not configurable. It's HTML5.

Examples

Empty input

makeHTML()
<!DOCTYPE html>
<html>
  <head>
    <title></title>
  </head>
  <body></body>
</html>

Realistic input

makeHTML
  manifestURL: "/appcache.manifest"
  title: "Stellarpad"
  webApp: true
  cssPath: "/latest.css"
  jsPath: "/latest.js"
  favIcon: "/favicon.ico"
  appleTouchIconsPrecomposed:
    "72x72": "/Icon-72.png"
    "144x144": "/Icon-722x.png"
    "57x57": "/Icon.png"
    "114x114": "/Icon2x.png"
  jsCode: "$(function(){Stellarpad.initialize()})"
<!DOCTYPE html>
<html manifest="/appcache.manifest">
  <head>
    <title>Stellarpad</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/Icon-72.png">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/Icon-722x.png">
    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="/Icon.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/Icon2x.png">
    <link rel="stylesheet" href="/latest.css" type="text/css">
    <script type="text/javascript" src="/latest.js"></script>
    <script type="text/javascript">$(function(){Stellarpad.initialize()})</script>
  </head>
  <body></body>
</html>

Credits

The initial structure of this module was generated by Jumpstart, using the Jumpstart Black Coffee template.

License

make-document-html is released under the MIT License.
Copyright (c) 2013 Meryn Stol

npm loves you