2.0.1 • Published 4 years ago
@bam.tech/parcel-plugin-handlebars-mock v2.0.1
@bam.tech/parcel-plugin-handlebars-mock
Populate HTML file with mock data in development. It also let you register helper methods for handlebars
Installation
yarn add @bam.tech/parcel-plugin-handlebars-mock
Usage
Mock data
- Create a src/mockdirectory.
- For each html file (named foo.htmlfor example), create asrc/mock/foo.html.jswith the mock content:
module.exports = {
  bar: 'baz',
};- If NODE_ENVisproduction, then the plugin is not applied.
Register helper methods
- create a src/helperdirectory with anindex.jsthat register some templates
const Handlebars = require('handlebars');
Handlebars.registerHelper('isArrayBig', (array) => {
  return array.length > 3;
});