0.6.0 • Published 3 years ago

find-embedded-documents v0.6.0

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

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.