UNPKG

1.32 kBMarkdownView Raw
1# Get CSS
2Node module to get CSS from a URL
3
4Returns a promise for an object with details about a document's CSS
5Used in http://cssstats.com
6
7## Usage
8
9```js
10var getCss = require('get-css');
11
12var options = {
13 timeout: 5000
14};
15
16getCss('http://github.com', options)
17 .then(function(response) {
18 console.log(response);
19 })
20 .catch(function(error) {
21 console.error(error);
22 });
23```
24
25### Using the CLI
26
27```
28npm i -g get-css
29getcss google.com > google.css
30```
31
32## Response
33
34### `links`
35An array of objects base on `rel=stylesheet` links found in the document.
36
37Each object has the following:
38
39- `link` - the value from the `href` attribute for each link tag
40- `url` - an absolute url representation of the link
41- `css` - the contents of the file in the link
42- `imports` - an array of urls for `@import` rules
43
44### `styles`
45An array of contents from `style` tags found in the document.
46
47### `css`
48A concatenated string of all css found in links and styles
49
50### `pageTitle`
51The contents of the `title` tag in the document.
52
53## Options
54
55### `timeout`
56An integer to reflect the timeout for the request. Default: `5000`
57
58### `ignoreCerts`
59A boolean to determine whether invalid certificates are ignored. Default: `false`
60
61### `verbose`
62A boolean to determine whether errors should be `console.log`ged. Default: `false`