Junior
What templates have you used in HTML?
sobes.tech AI
Answer from AI
MVC, MVVM, Observer (via subscriptions to state changes), EventEmitter (for component interaction).
Sometimes used simpler approaches, such as dividing code into modules by functionality, or organizing UI based on Atomic Design principles.
Templates related to reusing markup can also be considered, for example:
- Includes: Inserting the content of one HTML file into another during build time or on the server side.
- Components (Web Components): Using custom elements with encapsulated structure, styles, and behavior.
- Templating Engines (Handlebars, Pug/Jade): Using syntax to dynamically generate HTML based on data.
<!-- Example of using include -->
<div class="header">
{% include 'header.html' %}
</div>
<!-- Example of using Web Component -->
<my-custom-element attribute-name="value"></my-custom-element>
<!-- Example of templating in Pug/Jade -->
div.container
h1 Hello, #{name}!
p This is a templating example.