You might want to take a look at Webcomponents! Webcomponents allow you to write your own controls and import them without having to copy paste them in your webpages everywhere. For example, if you have your own header control you can define it in a file (e.g. myHeader.js) as such:
class MyHeader extends HTMLElement
{
/* Your header style and layout */
}
window.customElements.define('my-header', MyHeader );
and then later reference in your HTML:
<!-- Include control -->
<script src="controls/myHeader.js"></script>
<!-- Later in your file -->
<my-header> </my-header>
That way, you don't have to copy paste the entire control in every file while also being able to reuse the control.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…