CSS minify
Try it interactively →POST /api/css-minifyMinify CSS for production. Removes whitespace and comments, shortens values, dedupes rules. Optional source map. Modern CSS supported (nested rules, custom properties, container queries).
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| css | string | — | Source stylesheet (UTF-8). Provide this OR `cssFile`. |
| cssFile | file | — | Upload the stylesheet as a file instead of pasting it inline. Decoded as UTF-8 server-side; provide this OR `css`. |
| filename | string | "input.css" | Filename used in warnings / errors. Doesn't affect the output bytes. |
| errorRecovery | boolean | false | When true, recover from parse errors and emit what could be parsed; warnings list the problems. |
Response
Modes: json, binary. Cache: yes (24h TTL).
Code samples
Built from the default example.
curl -X POST https://api.xtract.bot/api/css-minify \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"css": "body {\n background-color: #ffffff;\n color: rgb(0, 0, 0);\n margin: 0px 0px 0px 0px;\n}\n"
}'