Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrieljmj/tempimp
Importer for HTML templates
https://github.com/gabrieljmj/tempimp
Last synced: about 2 months ago
JSON representation
Importer for HTML templates
- Host: GitHub
- URL: https://github.com/gabrieljmj/tempimp
- Owner: gabrieljmj
- License: other
- Created: 2016-03-22T19:13:51.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-25T23:28:14.000Z (almost 9 years ago)
- Last Synced: 2024-11-17T11:08:29.748Z (about 2 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
tempimp
=======
HTML template importer.## Install
Via npm:
```console
$ npm install --save tempimp
```## Usage
```template/nav.html ``````html
```
```public/js/main.js ```
```js
import {importTemplate} from './import-template';
window.onload = function () {
importTemplate('template/nav.html', {doc: document}).then(content => {
const items = content.querySelectorAll('li.nav-item');
[].forEach.call(items, item => {
document.querySelector('nav > ul#nav-items').appendChild(item);
});
});
};
```
```index.html ```
```html
MmM
```