css-urls

2.0.44 • Public • Published

css-urls

Last version Coverage Status NPM Status

Get all URLs inside stylesheets

Install

$ npm install css-urls --save

Usage

const got = require('got')
const cssUrls = require('css-urls')

;(async () => {
  const url = process.argv[2]
  if (!url) throw new TypeError('Need to provide an url as first argument.')
  const text = await got(url, { resolveBodyOnly: true })
  const links = cssUrls({ text, url })
  links.forEach(({ url, normalizedUrl }) => console.log(normalizedUrl))
})()

API

cssUrls({url, text})

url

Required
Type: string

The target URL(s) for extracting URLs referenced.

text

Required
Type: string

The

The target URL(s) for extracting URLs referenced.

Related

  • html-urls – Get all urls from a HTML markup.
  • xml-urls – Get all urls from a Feed/Atom/RSS/Sitemap xml markup.

License

css-urls © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats

Readme

Keywords

Package Sidebar

Install

npm i css-urls

Weekly Downloads

589

Version

2.0.44

License

MIT

Unpacked Size

5.93 kB

Total Files

4

Last publish

Collaborators

  • kikobeats