find-html-dependencies
v0.6.0
Published
Finds all dependencies within an HTML string or codesen parser AST
Downloads
9
Readme
find-html-dependencies
Finds all dependencies within an HTML string or codsen-parser
AST. A dependency in this case is a resource referenced from the HTML including images, CSS files, and JavaScript files.
Install
$ npm install find-html-dependencies
Usage
const findHTMLDependencies = require("find-html-dependencies");
const dependencies = findHTMLDependencies(`
<img src="my-image.png" />
`);
// => [ { path: 'my-image.png', range: [ 13, 25 ] } ]
API
findHTMLDependencies(html)
Accepts a string or AST generated by codsen-parser
.
Returns an array of objects for each dependency found found.