find-resources

0.0.1 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i find-resources

Weekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • callumlocke