css-urls

Get all URLs inside stylesheets

Usage no npm install needed!

<script type="module">
  import cssUrls from 'https://cdn.skypack.dev/css-urls';
</script>

README

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