examples

Examples

Example config with Assemble

In your project's Gruntfile, options for the {{readme}} helper can be defined in the Assemble task options:

assemble: {
  options: {
    helpers: ['handlebars-helper-readme'],
    readme: {
      cwd: 'path/to/files',
      sep: '<!-- separator defined in Gruntfile -->',
      compare: function (a, b) {
        return a.index >= b.index ? 1 : -1;
      }
    }
  },
  files: {}
}

Usage example

Given you have this config in your project's gruntfile:

Our chapters.hbs file contains the following:

And the files we want to readme include these Lo-Dash and Handlebars templates:

The result, book/chapters.html would contain something like:

cwd example

Instead of writing out full paths, like this:

Just define a cwd in the readme options in your project's Gruntfile:

Now you can define paths in the templates like this:

Last updated

Was this helpful?