- Explain the use case for templating engines like handlebars
- Use the handlebars documentation
- Use handlebars to render simple content
- Use handlebars render iterative content
- Linking JS to handlebars
-
Explain the use case for templating engines like handlebars
- Pure DOM manipulation can become cumbersome
- Create a template and dynamically populate
- Especially for server-side rendered apps
- You still can use them on front-end
- More efficient or succinct code
-
Use handlebars to render simple content
- If your context/data has an object like { title: 'Hiyoo!!'}
- Use handlebars to render iterative content
- If you're context/data has an array of objects like { projects: [{name: 'My Project'}, {name: 'Another Project'}]}
OR
- Linking JS to handlebars
- Link your JS files and your css files in layout.hbs
- Paths will be from the 'public' folder