Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack: include html partial inside another partial?

Is there a way to include html partial inside another partial using webpack? I am using html-loader to do this:

index.html

<%= require('html-loader!./partials/_header.html') %>

But when I try to include another partial inside a _header.html it is not able to render it.

This is not working:

_header.html

<%= require('html-loader!./partials/_nav.html') %>
like image 246
mirta Avatar asked Mar 08 '18 08:03

mirta


1 Answers

I was combining a little and I was able to find a solution.

index.html

<%= require('html-loader?root=.&minimize=true&interpolate!./partials/_header.html') %>

and then in _header.html

${require('html-loader?root=.!../partials/_nav.html')}
like image 139
JanuszO Avatar answered Nov 20 '22 08:11

JanuszO