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

@pro-vision/assemble-lite

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pro-vision/assemble-lite

Minimal Tool to render Handlebars-Files via Node

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

assemble-lite

Minimal Tool to render Handlebars-Files via Node.

Installation

npm i @pro-vision/assemble-lite -D

Usage

const assembleLite = require('@pro-vision/assemble-lite');

assembleLite({
  baseDir: 'src/pages/',
  partials: 'src/components/**/*.hbs',
  pages: 'src/pages/**/*.hbs',
  templates: 'src/templates/**/*.hbs',
  data: [
    'src/components/**/*.json',
    'src/components/**/*.yaml',
    'src/templates/**/*.json',
    'src/templates/**/*.yml'
  ],
  helpers: 'src/helpers/*.js',
  target: 'target/pages',
}).then(() => {
  console.log('done!!');
});

Configuration

keytypeusage
baseDirpathDefines base directory
partialsglob | glob[]where are the partials
pagesglob | glob[]where are the pages
templatesglob | glob[]where are the templates
dataglob | glob[]where is the data
helpersglob | glob[]where are the custom handlebars-helpers (the collection from handlebars-helpers is already included - out of the box)
targetglob | glob[]defines, where to put the rendered files

Data Files

When generating html files, you can provide some data to be passed to the handlebars template and pages.

These data can be local to the template and would only be applied to it, when set as yaml front-matter in the .hbs file. Or be global and accessible by all the templates via the handlebars @root object. Global data are all .json, .yaml, .yml and *__data.js files in the src and pages directory. The js file would need to have a default function that returns a json. This function can also return a promise, but keep in mind that this will slow down the build time and make build caching more difficult.

// some-component__data.js

module.exports = async function() {
  await someFileSystemIO();

  return {
    // the actual data
  };
}

FAQs

Package last updated on 26 Nov 2024

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