cssafe
raw JSON → 0.0.1 verified Fri May 01 auth: no javascript
A TypeScript-based CSS transpiler that provides type safety for stylesheets. Currently at version 0.0.1 with unknown maturity and release cadence. Differentiates by aiming to catch CSS errors at compile time using TypeScript, unlike traditional CSS preprocessors or runtime solutions.
Common errors
error Error [ERR_MODULE_NOT_FOUND] ↓
cause Node.js version < 16 or using require instead of import
fix
Upgrade to Node.js >= 16 and use import statements.
error Uncaught TypeError: cssafe.transpile is not a function ↓
cause Importing wrong export or using old version without transpile method
fix
Check import: import cssafe from 'cssafe' then call cssafe.transpile()
Warnings
breaking Version 0.0.1 is a pre-release; API may change without notice. ↓
fix Pin to specific version and test thoroughly.
gotcha Default export is the main entry; named exports may not work if package uses CJS-like export pattern. ↓
fix Use default import: import cssafe from 'cssafe'
gotcha No README available; assumptions about API may be incorrect. ↓
fix Check source code or contact maintainer for documentation.
Install
npm install cssafe yarn add cssafe pnpm add cssafe Imports
- cssafe wrong
const cssafe = require('cssafe')correctimport cssafe from 'cssafe' - transpile wrong
import transpile from 'cssafe'correctimport { transpile } from 'cssafe' - CSSafeOptions wrong
import { CSSafeOptions } from 'cssafe'correctimport type { CSSafeOptions } from 'cssafe'
Quickstart
import cssafe from 'cssafe';
const result = cssafe.transpile(`
.foo {
color: red;
font-size: 16px;
}
`, { sourcemap: true });
console.log(result.code);