How to add .pug support

Jakub Górowski edited this page Mar 17, 2017 · 6 revisions

Install pug and pug-html-loader packages.

npm install --save-dev pug pug-html-loader

Add pug-html-loader to config/webpack.common.js.

module.exports = {
  module: {
    loaders: [
      { 
        test: /\.(pug|jade)$/, 
        loader: 'pug-html-loader' 
      }
    ]
  }
}

For WebPack 2.x and pug-html-loader in version ^1.1.1 use this syntax:

module.exports = {
  module: {
    rules: [
      { 
        test: /\.(pug|jade)$/, 
        use: ['raw-loader', 'pug-html-loader'] 
      }
    ]
  }
}

Use .pug template in component.

@Component({
  selector: 'app',
  templateUrl: './app.template.pug'
})
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.