Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

parcel-plugin-raw-mst

0.0.3 • Public • Published

parcel-plugin-raw-mst

Parcel plugin for loading Mustache templates as strings in your JS

Installation

npm i -D parcel-plugin-raw-mst

Usage

Whenever you require files with an .mst extension, they will be parsed as strings. For example:

people.mst

<ul>
  {{#people}}
  <li>{{name}}</li>
  {{/people}}
</ul>

index.js

const Mustache = require("mustache");
const template = require("./people.mst");
 
const view = { people: [{ name: "Jane" }, { name: "John" }] };
 
console.log(Mustache.render(template, view));
// <ul>
//   <li>Jane</li>
//   <li>John</li>
// </ul>

Options

To override the default options, create a .rawMst.js file at the root of your project, which exports an object. For example:

module.exports = {
  minify: process.env.NODE_ENV === "production",
};

minify

type: Boolean
default: false

Replaces line-breaks and consecutive spaces with a single space.

Install

npm i parcel-plugin-raw-mst

DownloadsWeekly Downloads

41

Version

0.0.3

License

ISC

Unpacked Size

2.7 kB

Total Files

4

Last publish

Collaborators

  • avatar