本文介绍了Webpack:将html部分包含在另一个部分中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以使用webpack在另一部分中包含html部分?我正在使用html-loader执行此操作:
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') %>
但是当我尝试在_header.html中包含另一个部分时,它无法呈现它.
But when I try to include another partial inside a _header.html it is not able to render it.
这不起作用:
_header.html
<%= require('html-loader!./partials/_nav.html') %>
推荐答案
我稍加组合便能够找到解决方案.
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') %>
,然后在 _header.html
${require('html-loader?root=.!../partials/_nav.html')}
这篇关于Webpack:将html部分包含在另一个部分中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!