html-import-js

1.0.1 • Public • Published

html-import-js

Small library, to import HTML webcomponents inside a JS ES6 file.

Getting started

  1. Add html-import-js to your project:

    npm i -S html-import-js

  2. Require the function

    import { importHref } from 'html-import-js';
  1. Use it to require a HTML compomemt
    importHref ('./bower_components/paper-input/paper-input.html');

Parameters

importHref supports 4 parameters:

href, onload, onerror, optAsync

Parameter Description
href The relative url of the html file
onload Callback to notify when an import successfully loaded
onerror Callback to notify when an import unsuccessfully loaded.
optAsync True if the import should be loaded async, Defaults to false.

Disclaimer

All this code is taken from the Polymer library, as they removed this functionality in the polymer 3 version, this library allows to use it again

Readme

Keywords

none

Package Sidebar

Install

npm i html-import-js

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

5.59 kB

Total Files

4

Last publish

Collaborators

  • vlaraort