pug-loader cannot be passed data or locals in webpack

If you wanna pass data through pug-loader in webpack, you’ll get error like something undefined

so you only can use gulp-pug to pass data to pug, like

1
2
3
4
5
6
7
8
9
10
  /**
   * pug to html
   */
   gulp.task('html',function(){
     return gulp.src('./app/src/html/index.pug')
     .pipe(pug({
       locals: locals
     }))
     .pipe(gulp.dest('./app/dist/html'))
   });
comments powered by Disqus