Skip to content Skip to sidebar Skip to footer

Pass Data To Pug Using Pug-html-loader (cannot Read Property Of Undefined)

According to the readme of pug-html-loader, the loader accepts a data object which is being passed as part of the options to the template. While not available on the options within

Solution 1:

You should reference data directy (i.e. without prefixing the fields with data)

So you should change your code like so:

{
  loader: 'pug-html-loader',
  options: {
    data: {
      title: 'Hello World'
    }
  }
}

And then reference it from your PUG template Updated

doctype html
html
  head
    title= title

Post a Comment for "Pass Data To Pug Using Pug-html-loader (cannot Read Property Of Undefined)"