pugjs / pug-loader

Pug loader module for Webpack
MIT License
425 stars 119 forks source link

cannot pass data or loacals to pug #50

Open dxcqcv opened 8 years ago

dxcqcv commented 8 years ago

I wanna pass json data and function to pug, so in webpack.config.js

  {
    test:/\.pug$/,
    exclude: ['/node_modules/'],
    loader: 'pug',
    query: {   
      locals: {bb:function(str){return str + '444';},aa:'666'},
      pretty: true
    }
  },

in pug files

p!= locals.aa

the p tag will get nothing

so how to pass data to pug, and that will be OK in gulp-jade, help ,thx

TimothyGu commented 8 years ago

Webpack doesn't support passing functions in queries.

lekhnath commented 8 years ago

Cannot pass non-function values also.

dxcqcv commented 7 years ago

@TimothyGu so, does anyway pass variable to pug template by pug-loader, non-function

cdll commented 7 years ago

same issue here~ any one could help?

dxcqcv commented 7 years ago

My solution is mix gulp and webpack, you can see my repo @cdll