2.2.2 • Published 4 years ago

webpack-route-data-mapper v2.2.2

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

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`
2.2.2

4 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.0

6 years ago