Vue CLI - handlebar

bonjour·2019년 11월 27일
0

vue build시 lodash 템플릿을 사용하는 html이 만들어지는데
이를 핸들바의 템플릿을 사용하려고 한다.

  • handlebars
  • handlebars-loader
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  indexPath: 'index.hbs',
  configureWebpack: {
    plugins: [
      new HtmlWebpackPlugin({
        inject: true,
        template: 'public/index.hbs',
        title: 'Hello world'        
      })
    ]
  },
 chainWebpack: config => {
    config.module
      .rule('hbs')
      .test(/\.hbs$/)
      .use('handlebars-loader')
      .loader('handlebars-loader')
      .end()
  },  
<html>
  <title>{{  htmlWebpackPlugin.options.title }}</title>
</html>
profile
봉쥬

0개의 댓글