find-embedded-documents
v0.6.0
Published
Finds all embedded CSS and JavaScript documents within an HTML string or codesen parser AST
Downloads
4
Readme
find-embedded-documents
Finds all embedded CSS and JavaScript documents within an HTML string or codsen-parser
AST.
Install
$ npm install find-embedded-documents
Usage
const findEmbeddedDocuments = require("find-embedded-documents");
const documents = findEmbeddedDocuments(`
<style>body {background: blue;}</style>
`);
// => [ { tag: 'style', type: 'css', content: '', range: [...] } ]
API
findEmbeddedDocuments(html)
Accepts a string or AST generated by codsen-parser
.
Returns an array of objects for each embedded document found.