2.1.0 • Published 11 months ago

@pro-vision/assemble-lite v2.1.0

Weekly downloads
36
License
ISC
Repository
github
Last release
11 months ago

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
  };
}
2.1.0

11 months ago

2.0.9

2 years ago

2.0.7

3 years ago

2.0.8

3 years ago

2.0.5

4 years ago

2.0.6

4 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.4

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.3-alpha.28

5 years ago

1.2.3-alpha.8

5 years ago

1.2.3-alpha.23

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago