Overview
Barbiche is a logic-full template engine for browser environment. It has been designed to give you complete control over the data you want to merge into an HTML fragment. Once minified and gzipped, Barbiche size is 11KB.
Features
Barbiche supports:
- text and HTML insertion
- conditions (
if
and optionalelse
) - aliases
- loops
- flexible subtemplate imports
- attribute setting
- class setting
Barbiche has a complete test suite that can be run in your browser.
Sample
We ask Barbiche to merge some data into an HTML template:
The returned document fragment can then be inserted anywhere you want. It contains:
Browser support
Barbiche requires support of <template>
element and basic support of element.classList
API. Here is the support table:
Native (v2 & v3) | Polyfilled (v2) | Polyfilled (v3) | |
---|---|---|---|
Chrome | ≥26 | ≥15 | ≥26 |
Firefox | ≥22 | ≥22 | ≥22 |
IE/Edge | No support | ≥9 | ≥11 |
Opera | ≥15 | ≥11.6 | ≥15 |
Safari | ≥9 | ≥6.2 | ≥6.2 |
Polyfills, once minified and gzipped, weight an additionnal 2KB.