Open var-bp opened 7 years ago
Hello, I have a problem. I need to compile and include another file passed by function.
// index.jade // I'm using bemto mixin foo() - var blockName = 'some-block' // simplified example +b.some-block != htmlWebpackPlugin.options.getBlock(blockName) +foo() // some-block.pug +e.element Some text // webpack.config.js use: { loader: 'pug-loader', } new HtmlWebpackPlugin({ filename: index.html, template: index.pug getBlock: function(blockName) { return fs.readFileSync(`${blockName}.pug`, { encoding: 'utf8' }); }, })
What I get:
// index.html <div class="some-block">+e.element Some text</div>
What I need :
// index.html <div class="some-block"> <div class="some-block__element">Some text</div> </div>
Is this possible? I would be grateful if you help.
seems like fs.readFileSync is just giving you the file contents, which is not parsed by the pug-loader (via webpack). Because it's not required?
fs.readFileSync
require
Hello, I have a problem. I need to compile and include another file passed by function.
What I get:
What I need :
Is this possible? I would be grateful if you help.