html-requirer

0.0.7 • Public • Published

html-requirer Build Status

Allows you to require html into your js as a string for use in templates. Uses readFileSync under the hood, so works best in situations performance is not so important. i.e. build scripts.

Install

npm install html-requirer

Usage

const requireHtml = require('html-requirer');
const header = requireHtml('../../templates/header.html');
 
const html = `
  <!doctype html>
  <html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    ${header}
    <section>
      <p>other stuff</p>
    </section>
  </body>
  </html>
`;
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.7
    2
    • latest

Version History

Package Sidebar

Install

npm i html-requirer

Weekly Downloads

2

Version

0.0.7

License

MIT

Last publish

Collaborators

  • supercrabtree