-2

Does a developer tool exists what can include a HTML file into another one? For example:

image.html:

<img src="img/hero.jpg" alt="Hello World">

main.html:

<html>
<head>...</head>
<body>
<!-- some content -->
<%= include 'image.html' %>
<!-- some other content -->
</body>
</html>

The syntax is whatever, I think this is the EJS webpack loader's syntax, but this is an example.

I'm looking for this because html webpack's html-loader not working.

Good answer can be a working webpack.config.js file or another developer tool too.

netdjw
  • 5,419
  • 21
  • 88
  • 162
  • it's just pure html – netdjw Jul 27 '18 at 11:11
  • then I'm not sure, PHP be my ballgame - google have nothing? – treyBake Jul 27 '18 at 11:11
  • I found noting useful in Google. I'm sure there is a tool, just I'm using wrong keywords to search, but I have no idea... – netdjw Jul 27 '18 at 11:13
  • This looks like an typical [XY problem](https://meta.stackexchange.com/a/66378). Try to fix what is not working with html-loader instead? – ChrisR Jul 27 '18 at 11:26
  • I have a question about html-loader, but don't have answer... https://stackoverflow.com/questions/51527619/how-to-include-raw-static-html-file-into-another-html-file-with-webpack – netdjw Jul 27 '18 at 11:33

3 Answers3

-1

You could use jQuery to embed a piece of HTML into an other file.

$("#MyElement").load("navigation.html");


<div id="MyElement"></div>
Jeroen Smink
  • 179
  • 1
  • 10
-1

Use jquery ajax load

$( "body" ).load( "image.html", function() {
  alert( "Load was performed." );
});
Alfin Paul
  • 1,543
  • 14
  • 26
  • not a jquery level problem... I want to create a HTML file what contain the other HTML file's code. – netdjw Jul 27 '18 at 11:35
-1

The answer is here. Webpack can handle the problem with html-loader interpolation option.

netdjw
  • 5,419
  • 21
  • 88
  • 162