0.0.1 • Published 10 years ago

find-resources v0.0.1

Weekly downloads
-
License
-
Repository
-
Last release
10 years ago

find-resources Build Status

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 a url(...)).
  • 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.