Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including template-html with all npm packages installed. Try it out:

var templateHtml = require("template-html")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

template-html v0.3.2

Generate static HTML files from templates and content files


NPM Version Build Status Dependency Status

Generate static HTML files from templates and content files. gulp-template-html is a Gulp plugin for this with example usage.


$ npm install -g template-html


Usage: template-html content.html -t template.html [options]

-h|--help      display this help message
-v|--version   display the version number
-o|--output    directory to output processed HTML
-t|--template  template file to use
--tag          keyword to use be used in HTML placeholder define and build comments
--build-tag    keyword to use be used in HTML placeholder build comments (overrides --tag)
--define-tag   keyword to use be used in HTML placeholder define comments (overrides --tag)
--preserve-tree  output files will keep the same directory structure as the source files

Sample usage

For the most basic use case of this plugin, create a template file with placeholders and a file containing the content that should replace the placeholders in the template.

For more details and more complex examples take a look at the examples directory.


<!DOCTYPE html>

<html lang="en">
<meta charset="utf-8">
<title><!-- build:title --></title>
  <div id="content"><!-- build:content --></div>


<!-- build:title -->Lorem ipsum<!-- /build:title -->
<!-- build:content -->
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
<!-- /build:content -->



Creates a new Templator instance.


  • Object options: An object containing the following fields:
  • templateFile (String): Path to template file to use.
  • tag (String): Keyword to use be used in HTML placeholder comments.


Run the contents of an HTML file through the Templator


  • String contentFile: Path to HTML file to be processed


  • String The processed HTML


Generate HTML from template file and content file


  • String content: HTML content to be used in template


  • String The processed HTML

How to contribute

  1. File an issue in the repository, using the bug tracker, describing the contribution you'd like to make. This will help us to get you started on the right foot.
  2. Fork the project in your account and create a new branch: your-great-feature.
  3. Commit your changes in that branch.
  4. Open a pull request, and reference the initial issue in the pull request message.


See the LICENSE file.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free