Skip to content
HALOWERK

Codewerk

unused css

Runs PurgeCSS 8 over the HTML of a page and its CSS: inline <style> blocks are always included; CSS can be passed inline or, with a page URL, linked stylesheets are fetched (robots.txt respected, at most 6 stylesheets, 1.5 MB each). Reports for every stylesheet the rejected selectors, size before and after and the saved share; unused @keyframes and @font-face rules are removed by default, unused custom properties on request. Safelist entries keep classes or ids that are added by JavaScript.

POST https://code.halowerk.com/v1/unused-css

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
htmlstringNoHTML of the page (with inline <style> blocks).
cssstringNoAdditional stylesheet content.
stylesheetsarrayNoSeveral named stylesheets.
urlstringNoAlternative: public page URL; its HTML and linked stylesheets are fetched.
safelistarrayNoClass or id names to keep (added by JavaScript), e.g. "is-open"; a trailing * keeps every name with that prefix, e.g. "js-*".
remove_unused_keyframesbooleanNo
remove_unused_font_facesbooleanNo
remove_unused_variablesbooleanNo
include_purged_cssbooleanNoReturn the purged CSS per stylesheet.
max_listintegerNoMaximum rejected selectors listed per stylesheet.
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "html": {
      "type": "string",
      "minLength": 1,
      "maxLength": 240000,
      "description": "HTML of the page (with inline <style> blocks)."
    },
    "css": {
      "type": "string",
      "maxLength": 240000,
      "description": "Additional stylesheet content."
    },
    "stylesheets": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "css"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "css": {
            "type": "string",
            "maxLength": 240000
          }
        }
      },
      "description": "Several named stylesheets."
    },
    "url": {
      "type": "string",
      "format": "uri",
      "maxLength": 2000,
      "description": "Alternative: public page URL; its HTML and linked stylesheets are fetched."
    },
    "safelist": {
      "type": "array",
      "maxItems": 200,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200,
        "pattern": "^[.#]?[A-Za-z0-9_-]+\\*?$"
      },
      "description": "Class or id names to keep (added by JavaScript), e.g. \"is-open\"; a trailing * keeps every name with that prefix, e.g. \"js-*\"."
    },
    "remove_unused_keyframes": {
      "type": "boolean",
      "default": true
    },
    "remove_unused_font_faces": {
      "type": "boolean",
      "default": true
    },
    "remove_unused_variables": {
      "type": "boolean",
      "default": false
    },
    "include_purged_css": {
      "type": "boolean",
      "default": false,
      "description": "Return the purged CSS per stylesheet."
    },
    "max_list": {
      "type": "integer",
      "minimum": 1,
      "maximum": 2000,
      "default": 300,
      "description": "Maximum rejected selectors listed per stylesheet."
    }
  }
}

Open original schema

Published input example

{
  "html": "<div class=\"card\"><p>Hi</p></div>",
  "css": ".card{padding:1rem}.modal{display:none}p{margin:0}"
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’