sagold / handlebars-webpack-plugin

Renders your html-template at build time
162 stars 45 forks source link

add option to override partial ID determination #51

Closed TheReincarnator closed 5 years ago

TheReincarnator commented 5 years ago

Adds an option to override how partial IDs are created.

This gives you the ability to have a folder structure of partials, like this:

src
  partial
    de
      top.hbs
      bottom.hbs
    en
      top.hbs
      bottom.hbs

With a configuation like this:

partials: [path.join(process.cwd(), "src/partial/**/*.hbs")],
getPartialId: path => path.replace(/^.*\/src\/partial\/(.*)\.[^.]+$/, "$1"),

a partial at src/partial/en/header.hbs would become ID en/header.