hubcap stylesheets

List all stylesheets loaded on the current page.

When to use

Use stylesheets to enumerate every stylesheet attached to the page, including external files and inline styles. Useful for auditing CSS assets, detecting unused stylesheets, or verifying that expected styles are loaded.

Usage

hubcap stylesheets

Arguments

None.

Flags

None.

Output

FieldTypeDescription
stylesheetsarrayArray of stylesheet info objects
stylesheets[].styleSheetIdstringIdentifier for the stylesheet
stylesheets[].sourceURLstringURL of the stylesheet, empty for inline styles
stylesheets[].titlestringTitle of the stylesheet
stylesheets[].disabledbooleanWhether the stylesheet is disabled
stylesheets[].isInlinebooleanWhether the stylesheet is an inline <style> block
stylesheets[].lengthnumberNumber of CSS rules in the stylesheet
{
  "stylesheets": [
    {
      "styleSheetId": "0",
      "sourceURL": "https://example.com/styles.css",
      "title": "",
      "disabled": false,
      "isInline": false,
      "length": 42
    },
    {
      "styleSheetId": "1",
      "sourceURL": "",
      "title": "",
      "disabled": false,
      "isInline": true,
      "length": 5
    }
  ]
}

Errors

ConditionExit codeStderr
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

List all stylesheets:

hubcap stylesheets

Count external vs inline stylesheets:

hubcap stylesheets | jq '{external: [.stylesheets[] | select(.isInline | not)] | length, inline: [.stylesheets[] | select(.isInline)] | length}'

List all external stylesheet URLs for a page:

hubcap goto "https://example.com" && hubcap stylesheets | jq -r '[.stylesheets[] | select(.sourceURL != "") | .sourceURL] | .[]'

See also