# get-css

> Get CSS from a URL

Latest version **4.0.3** (published 2021-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-css
pnpm add get-css
yarn add get-css
bun add get-css
```

Provides the command `getcss`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2021-03-01 |
| First published | 2014-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Brent Jackson |
| Maintainers | johno, jxnblk |
| Keywords | CSS, request, parse, get, getcss |

## Links

- npm: https://www.npmjs.com/package/get-css
- Repository: https://github.com/cssstats/get-css
- Issues: https://github.com/cssstats/get-css/issues
- npm.io page: https://npm.io/package/get-css

## Dependencies (15)

- [q](https://npm.io/package/q.md) ^1.5.1
- [is-css](https://npm.io/package/is-css.md) ^4.0.0
- [cheerio](https://npm.io/package/cheerio.md) ^0.22.0
- [is-blank](https://npm.io/package/is-blank.md) ^2.1.0
- [commander](https://npm.io/package/commander.md) ^6.2.0
- [ua-string](https://npm.io/package/ua-string.md) ^3.1.0
- [is-present](https://npm.io/package/is-present.md) ^1.0.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [query-string](https://npm.io/package/query-string.md) ^6.13.6
- [is-url-superb](https://npm.io/package/is-url-superb.md) ^4.0.0
- [normalize-url](https://npm.io/package/normalize-url.md) ^5.3.0
- [abort-controller](https://npm.io/package/abort-controller.md) ^3.0.0
- [strip-html-comments](https://npm.io/package/strip-html-comments.md) 1.0.0
- [strip-wayback-toolbar](https://npm.io/package/strip-wayback-toolbar.md) ^1.0.4
- [resolve-css-import-urls](https://npm.io/package/resolve-css-import-urls.md) ^4.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 4.0.3 (latest) — 2021-03-01
- 4.0.1 — 2021-02-24
- 4.0.0 — 2020-12-08
- 3.5.0 — 2020-11-03
- 3.4.1 — 2020-02-18
- 3.4.0 — 2019-09-02
- 3.3.1 — 2019-07-26
- 3.3.0 — 2019-03-23
- 1.2.7-2 — 2018-03-28
- 1.2.7-0 — 2018-03-28
- 1.2.6 — 2018-01-19
- 1.2.5 — 2017-09-15
- 1.2.4 — 2017-09-15
- 1.2.3 — 2016-12-24
- 1.2.1 — 2015-10-07
- … 16 more at https://npm.io/package/get-css/versions

## README

# get-css [![Build Status](https://travis-ci.org/cssstats/get-css.svg?branch=master)](https://travis-ci.org/cssstats/get-css)

Node module to get CSS from a URL.

Returns a promise for an object with details about a document's CSS, used in <http://cssstats.com>.

## Installation

```sh
npm i --save get-css
```

For the CLI

```sh
npm i -g get-css
```

## Usage

```js
var getCss = require('get-css')

var options = {
  timeout: 5000
}

getCss('http://github.com', options)
  .then(function(response) {
    console.log(response)
  })
  .catch(function(error) {
    console.error(error)
  })
```

### Using the CLI

```
npm i -g get-css
getcss google.com > google.css
```

## Response

### `links`

An array of objects base on `rel=stylesheet` links found in the document.

Each object has the following:

- `link` - the value from the `href` attribute for each link tag
- `url` - an absolute url representation of the link
- `css` - the contents of the file in the link
- `imports` - an array of urls for `@import` rules

### `styles`

An array of contents from `style` tags found in the document.

### `css`

A concatenated string of all css found in links and styles

### `pageTitle`

The contents of the `title` tag in the document.

## Options

### `timeout`

An integer to reflect the timeout for the request. Default: `5000`

### `ignoreCerts`

A boolean to determine whether invalid certificates are ignored. Default: `false`

### `verbose`

A boolean to determine whether errors should be `console.log`ged. Default: `false`

## License

MIT

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

---
_Source: https://npm.io/package/get-css · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
