Registry / serialization / css-box-shadow

css-box-shadow

JSON →
library1.0.0-3jsnpmunverified

A zero-dependency CSS box-shadow parser and stringifier. Current stable version 1.0.0-3. Lightweight, simple API to convert between CSS string values and structured objects, and vice versa. Useful for manipulating box-shadow values programmatically in styling tools, CSS-in-JS libraries, or animation systems. No dependencies, works in Node and browser.

npm install css-box-shadow
INSTALL
IMPORT
SIG · CSS-BOX-SHADOW
C
css-box-shadow
serializationjavascriptv1.0.0-3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import { parse } from 'css-box-shadow'
import parse from 'css-box-shadow'
Named export; default export is not available.
stringify
import { stringify } from 'css-box-shadow'
import { stringify } from 'css-box-shadow'; const { stringify } = require('css-box-shadow')
Also works with CommonJS require(). Both ESM and CJS are supported.
parse (CommonJS)
const { parse } = require('css-box-shadow')
const parse = require('css-box-shadow').default
No default export; destructure the required object.

Parses a CSS box-shadow string into an array of objects, then stringifies it back.

import { parse, stringify } from 'css-box-shadow'; const shadowString = '0 0 0 32px tomato'; const parsed = parse(shadowString); console.log(parsed); // [{ inset: false, offsetX: 0, offsetY: 0, blurRadius: 0, spreadRadius: 32, color: 'tomato' }] const reconstructed = stringify(parsed); console.log(reconstructed); // '0 0 0 32px tomato'
Debug
Known issues
gotchaThe package version is 1.0.0-3 (pre-release). API may change between minor versions.
fix
Pin to exact version if stability is critical.
affects: 1.0.0-*
gotchaOnly supports a limited subset of CSS box-shadow syntax; multiple shadows with comma separation are supported as array, but `inset` keyword must be first if present.
fix
Ensure input strings follow standard CSS box-shadow format.
affects: >=0.0.0
gotchaThe package does not perform validation of color values; arbitrary strings accepted.
fix
Validate color values separately if needed.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot read properties of undefined (reading 'match')
Passing a non-string value to parse().
fix
Always pass a string: const result = parse(String(value));
TypeError: stringify is not a function
Attempting to call stringify as default import.
fix
Use named import: import { stringify } from 'css-box-shadow'
Upgrade
Version history
1.0.0-3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
css-box-shadow — npm install css-box-shadow · libregistry