html-imports-content
HTML Imports with content inlining, or replacing by selector.
Features
- Enables simple client-side page composition, with support for lazy loading.
- Improve speed of web by allowing different HTML snippets to be cached independently. Similar in concept to Edge Side Includes (ESI).
- Declarative definition to encourage future native browser implementation and search engine support.
Install
Bower
bower install --save html-imports-content
npm
npm install --save html-imports-content
Use
<!-- ... -->
Inline
Inserts loaded HTML inline (at the same location as the statement):
Replace
Replaces element(s) matching CSS selector specified in replace
attribute with loaded HTML:
Manual
var link = document;linkrel = "import";linkhref = "header.html";link;documentbody; window; // or multiple:// window.importsContent( [ link, link2, ... ] );