iced-coffee-middleware (also known as `coffee-middleware`) is a Connect/Express middleware designed for on-the-fly compilation of CoffeeScript files (`.coffee`) into JavaScript. Currently at version 0.2.1, it provides functionality to dynamically serve compiled JavaScript, offering options such as `force` for continuous recompilation, `bare` for compilation without the top-level safety wrapper, and `encodeSrc` for embedding base64 source maps. This package leverages patterns from `less-middleware` and is built for integration with older `connect` and `express` versions that utilized `createServer()` and `app.configure()`. Due to its reliance on these long-deprecated APIs and the declining prevalence of CoffeeScript in new web development, the package's active maintenance and applicability to modern Node.js ecosystems are highly questionable. Its development cadence is effectively halted, with no significant updates in many years, making it primarily a historical artifact rather than a viable solution for contemporary projects.
npm install iced-coffee-middlewareVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up `coffee-middleware` with an older Express 3.x application to compile and serve CoffeeScript files on demand, including a basic example `.coffee` file and a server setup.
Consider using modern build tools (e.g., Webpack, Rollup, Vite) to precompile CoffeeScript (or switch to TypeScript/modern JS) or use an Express 3.x compatible environment for this middleware.
Evaluate if CoffeeScript is still the appropriate language for your project. Consider migrating to TypeScript or plain JavaScript with a modern build setup for better tooling and community support.
Ensure your project is configured for CommonJS modules if using this package, or use `require()` within an ESM module if supported by your runtime/transpiler setup (e.g., Node.js with `createRequire`).
Use with caution in production. Review the source code for potential vulnerabilities or unhandled edge cases. Consider if a more mature and maintained solution exists for your needs.
This middleware is designed for Express 3.x. You either need to downgrade Express (e.g., `npm install express@3.x`) or refactor your application to not use this legacy middleware.
Ensure the package is installed: `npm install coffee-middleware` (or `npm install iced-coffee-middleware` if that was the intended name, though the readme uses `coffee-middleware`). Check `node_modules` and your `package.json`.
This package is CommonJS. Use `const coffeeMiddleware = require('coffee-middleware');` and ensure your file is treated as CommonJS (e.g., no `"type": "module"` in `package.json` or rename to `.cjs`).