First of all, I congratulate you on your question.
It addresses one of the basic needs and most important principles of programming: DRY , which is the main reason for developing and implementing most common web technologies, such as php or CSS (which can be additionally DRY-ed on LESS or SASS ).
php , for example, was invented and instantly widely accepted mainly due to this βvery cool new (at that time) functionβ: all you had to do was change the extension from .html to .php , and you could enable other parts using:
<?php include "part.html"; ?>
Commonly referred to as loading a template / component , it is also a common task using JavaScript . This gives several libraries. For example, jQuery provides $.load() , and AngularJS allows you to use directive to include template s, which can be defined as embedded or external HTML . In fact, all package dependency managers and all frameworks provide it in one form or another, because today the network is unthinkable without reusable components.
If you want to find more options, I suggest you start looking for combinations of HTML , include , templates , loading and components .
Be careful, most JavaScript libraries have overhead. However, the most popular ones tend to provide some flexibility, allowing you to selectively create only the features you want.
The inclusion of templates is likely to become part of the core of the HTML if (and when) Microsoft HTML components in the World Wide Web Consortium will be adopted using the <component> .
This is currently possible with the AngularJS type:"E" directives.
source share