HTML+ templates can be made fully aware of your data files. Injecting or creating context data is super easy to do either inside the template itself or in the initial engine setup.
Another spectacular aspect of the data is that it can be contextualized and there is no need to keep passing data to partial files when you include them.
Data can be provided or created in few ways:
- Through initial engine setup: This is great for when you want to fetch data from database when server starts and make it available inside templates.
- On every page request: This is particular great when you want to inject data specific to that template or something from the request like form data, cookies, params, query, uploaded file details, etc.
- On includes: Partial files already inherit the data and context from the file it was included in but you can pass additional context data as well.
- variables: This is great when you want for a specific part of the template to have a unique sample of the data and even override the global data provided locally.
With HTML+ templates, data can be global and scoped(context) which allows for unique templates to be build to fit the exact need of your project.
The templates are built in a way that enforces data immutability. This is so when you override data in one template it will never affect how data is in another.