Skip to content

vlaraort/html-import-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published