webpack-route-data-mapper

2.2.2 • Public • Published

webpack-route-data-mapper

// webpack.config.js
 
const routeDataMapper = require('webpack-route-data-mapper');
 
const sharePageData = {
  a: {
    title: 'share page A'
  },
  b: {
    title: 'share page A'
  }
};
 
module.exports = {
  /*
    (your loader settings)
  */
  plugins: [
    routeDataMapper({
        baseDir: `./src/pug/page`,
        src: '**/[!_]*.pug',
        // template base locals data
        locals: {
          url: 'example site'
        },
        // mapping template name for html path
        routes: {
            '/share/:shares': 'share.pug'
        },
        // data for each routing
        data: {
            shares: sharePageData
        },
    })    
  ]
};
 
// => will generate `/share/a/index.html` and `/share/b/index.html`

Readme

Keywords

none

Package Sidebar

Install

Weekly Downloads

3

Version

2.2.2

License

MIT

Unpacked Size

5.54 kB

Total Files

5

Last publish

Collaborators

  • fnobi