HTML Imports visitor
A helper library to traverse the spanning tree of the HTML imports graph.
The linking structure of import link lists forms a directed graph. Each node of the graph is a document and its edge is a link. Branches are intended to form a spanning tree of the graph. This tree gives the deterministic order of the script execution.
Install
npm install [--save-dev] html-imports-visitor
Example
<script>
s in proper execution order
Visit const visitor = /** * Function hook called when a `<link rel="import">` is found * * @param * @param * @param */ { // your code } /** * Function hook called when entering a branch of the tree * * @param * @param */ { // your code } /** * Function hook called when a `<script>` is found * * @param * @param * @param */ { // your code } const helper = visitor predicates helper
Demo
You can find the minimum configuration needed to run the library in demo/demo.js and you can try it running:
node demo/demo.js
html-visitor-imports
uses parse5, documentation about parsed elements can be found here
Also note that remote or non-existing files will be not entered.
rollup.js
Bundle scripts withTake a look at rollup-plugin-html-entry for a real world usage example.
License
MIT