npm.io
0.6.0 • Published 5 years ago

find-html-dependencies

Licence
MIT
Version
0.6.0
Deps
3
Size
13 kB
Vulns
0
Weekly
0

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.