Registry / web-framework / coffee-stylesheets

coffee-stylesheets

JSON →
library0.0.5jsnpmunverified

CoffeeStylesheets is an experimental transpiler that converts CoffeeScript function calls into CSS, similar to SASS/SCSS/LESS/Stylus but entirely CoffeeScript-based. Version 0.0.5 (no recent updates) is currently available on npm. It compiles to pure JavaScript concatenation without string parsing, offering faster template compilation than Stylus (claimed 90% faster). It is stand-alone with no dependencies, and allows using common JavaScript/CoffeeScript functions like require() within templates. However, the project has not been updated in years, and the package may be unstable or incomplete. It runs in both Node.js and browser environments.

npm install coffee-stylesheets
INSTALL
IMPORT
SIG · COFFEE-STYLESHEETS
C
coffee-stylesheets
web-frameworkjavascriptv0.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

CoffeeStylesheets
import CoffeeStylesheets from 'coffee-stylesheets'
const CoffeeStylesheets = require('coffee-stylesheets')
CommonJS require may not work due to lack of proper module.exports; use ES6 import.
CoffeeStylesheets
let engine = new CoffeeStylesheets({ format: true })
let engine = new CoffeeStylesheets(true)
Constructor takes an options object, not a boolean. Common mistake for new users.
CoffeeStylesheets
import CoffeeStylesheets from 'coffee-stylesheets'
import { CoffeeStylesheets } from 'coffee-stylesheets'
This package exports a default function/class; named import will fail.

Demonstrates creating a CoffeeStylesheets engine with a global helper and rendering a stylesheet to CSS.

const CoffeeStylesheets = require('coffee-stylesheets').default || require('coffee-stylesheets'); const engine = new CoffeeStylesheets({ format: true, globals: { px: (i) => i + 'px', border_radius: function(s) { return ` -moz-border-radius: ${s}; -webkit-border-radius: ${s}; border-radius: ${s}; `; } } }); const stylesheet = () => { body(() => { background('black'); color('red'); p(() => { font_size('12px'); border_radius(px(5)); }); }); }; console.log(engine.render(stylesheet));
coffee-stylesheets --version
Debug
Known issues
deprecatedPackage is unmaintained since 2013; may contain bugs and lacks modern CSS features.
fix
Consider using SASS/SCSS, Less, or Stylus instead.
affects: <=0.0.5
gotchaThe package is written for CoffeeScript; using it from JavaScript requires wrapping functions to match CoffeeScript syntax (e.g., implicit returns).
fix
Ensure all functions return the expected value, and use CoffeeScript-like function bodies or compile from .coffee files.
affects: >=0.0.0
breakingThe default export may not be available via CommonJS require; require('coffee-stylesheets') may return an empty object.
fix
Use import or access .default: const CoffeeStylesheets = require('coffee-stylesheets').default;
affects: >=0.0.0
gotchaConstructor expects an options object; passing a single boolean argument (common in older examples) will cause unexpected behavior.
fix
Pass an object: new CoffeeStylesheets({ format: true }).
affects: >=0.0.0
gotchaThe CSS output may not be perfectly valid CSS3; vendor prefixes may be missing and some CSS properties may have different naming.
fix
Use established preprocessors for production CSS.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: CoffeeStylesheets is not a constructor
Import or require returns undefined or the default export is not correctly assigned.
fix
Use: const CoffeeStylesheets = require('coffee-stylesheets').default; or switch to ES6 import.
undefined is not a function (evaluating 'engine.render(stylesheet)')
engine is undefined because the constructor was called incorrectly (e.g., passing a boolean instead of object).
fix
Instantiate engine with an options object: new CoffeeStylesheets({ format: true }).
Cannot find module 'coffee-script'
The package requires CoffeeScript as a peer dependency but does not list it in package.json (or it is not installed).
fix
Install CoffeeScript: npm install coffee-script --save
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
coffee-stylesheets — npm install coffee-stylesheets · libregistry