And the styles would keep stacking up in the cascade. In order to use the template, we will need JavaScript. For this example, however, I wanted to make sure that the very basics were covered without getting too deep into the best way to import styles (something I’ll talk more about in the shadow DOM article). This function will create a copy of the template’s content and prepare it to be inserted into another document (or document fragment). If you have important information to share, please, Encapsulating Style and Structure with Shadow DOM. One thing that is bothering though. Hey Glenn, thanks for asking. Replace what's in the app.component.html … My core competencies include Javascript (ES6, React, Angular, Node), HTML, CSS, PHP, MongoDB, MySQL Perl and Java. Add jQuery CDN to the head section of the html file you wish to reuse the code in. Then, render it to the page using innerHTML: The JavaScript file defines a class called Header which extends the generic HTMLElement class. I was left with no choice other than to serially copy and paste the same header and footer sections into all 30 HTML files. Nice series. Learn more But how can we achieve this without a solid grasp of these component-based frameworks and a strong knowledge of JavaScript? In this example, we define , our very own HTML element. I almost made a component for every “div” layer… This means a lot of time was wasted passing props down the components’ tree. Start building reusable email content with the Email Designer. These aren’t the only ways to build reusable components though. :). One of the least recognized, but most powerful features of the Web Components specification is the