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.

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()
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.
npm install cssafe
yarn add cssafe
pnpm add cssafe

Transpiles a CSS string using cssafe with options.

import cssafe from 'cssafe';

const result = cssafe.transpile(`
  .foo {
    color: red;
    font-size: 16px;
  }
`, { sourcemap: true });

console.log(result.code);