5

I've intalled the express-generetor npm module and like how the project is structured with the jade files used as templates. However I also like to use the HTML-webpack-plugin which generates its own files, what is the best way to go about integrating both approaches?

SuperUberDuper
  • 9,242
  • 9
  • 39
  • 72

1 Answers1

0
  • Step1:

Generate your html file(s):

module.exports = {
  entry: {
    'page1': './apps/page1/scripts/main.js',
    'page2': './apps/page2/src/main.js'
  },
  output: {
    path: __dirname,
    filename: "apps/[name]/build/bundle.js"
  },
  plugins: [
    new HtmlWebpackPlugin({
      inject: true,
      chunks: ['page1'],
      filename: 'apps/page1/build/index.html'
    }),
    new HtmlWebpackPlugin({
      inject: true,
      chunks: ['page2'],
      filename: 'apps/page2/build/index.html'
    })
  ]
};
  • Step2: Add the generated html file(s) to your jade file

    include ../../public/index.html

Priyanshu Chauhan
  • 5,297
  • 5
  • 35
  • 34