Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mustache-prestatic

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mustache-prestatic

Compile pages of static HTML based on partials, views and data.

  • 2.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

{{ mustache }} prestatic

Travis Build Status LGTM Grade npm

Node.js module that turns mustache files, partials and data into static HTML pages. Making mustache.js usable through a simple CLI and JavaScript API by allowing multiple files as input. mustache-prestatic automatically maps the passed partial files to their file names and populates the template files from passed data files with the same name.

npm install mustache-prestatic --save-dev

Examples

CLI

This will take all files in the 'views', 'data' and 'partials' directories and use those together to write HTML files to the 'dist' directory:

mustache-prestatic ./views/*.mustache --data ./data/* --partials ./partials/* --output dist

For example using the test input data files would be:

mustache-prestatic ./tests/input/views/*.mustache --data ./tests/input/data/* --partials ./tests/input/partials/*

JavaScript

const { render } = require('mustache-prestatic');

const templateFiles = ['views/blog.mustache', 'views/home.mustache'];
const dataFiles = ['data/home.json'];
const partialFiles = ['partials/article.mustache', 'partials/header.mustache'];

render(templateFiles, dataFiles, partialFiles)
  .then(console.info);

API

CLI

Usage: mustache-prestatic templateFiles [options]
Compile pages of static HTML from mustache templates, data and partials.

Options:
  --help, -h      Show help text.
  --version, -v   Show version number.
  --data, -d      Input mustache template data files.
  --partials, -p  Input mustache partial files.
  --output, -o    Output directory, defaults to current directory.
  --verbose       Log extra information about the process to stdout.

JavaScript

mustachePrestatic(templateFiles, [dataFiles], [partialFiles])

Compile HTML from provided mustache files.

templateFiles

Type: Array
The files that contain the mustache templates, or often called views.

dataFiles

Type: Array
The files that contain the mustache template data, this data will populate the template files.

partialFiles

Type: Array
The files that contain the mustache partials, these are re-usable parts of views that get included.

Keywords

FAQs

Package last updated on 12 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc