find-resources
v0.0.1
Published
Scans HTML and CSS for local resource paths
Downloads
4
Readme
find-resources
Scans HTML and CSS for static resource URLs.
npm install find-resources
var findResources = require('find-resources');
var urls = findResources.html('<img src="foo.jpg"><link rel="stylsheet" href="bar.css">');
console.log(urls);
// > ['foo.jpg', 'bar.css']
- You can also do
findResources.css(cssString)
to find resource URLs in CSS (background images, fonts – anything in aurl(...)
). - The
findResources.html()
function also uses the.css()
function under the hood to search inside inline<style>
elements. - Both functions accept a second argument of options.
Options
Pass an object with any of these properties, shown here with their default values, to choose what kinds of URLs should be included in the results:
domainRelative
(true)fileRelative
(true)data
(false)external
(false)
License
Copyright (c) 2014 . Licensed under the MIT license.