{"id":17938,"library":"sass-middleware","title":"SASS (Ruby Gem) Connect/Express Middleware","description":"This package provides Connect/Express middleware for compiling SASS files on the fly. It is an extremely old package, with its last known release being version 0.0.3, published over a decade ago. Crucially, it relies on the `sass` Ruby gem for compilation, which is now considered deprecated and superseded by Dart Sass (the official `sass` npm package). Due to its age and dependency on an outdated, external compiler (Ruby Sass), `sass-middleware` is abandoned and incompatible with modern Node.js environments and contemporary Express/Connect applications. Developers should instead integrate modern build tools (e.g., Webpack, Vite, Gulp) with Dart Sass for static compilation, or explore direct usage of the `sass` npm package API for programmatic compilation within a build process. The `node-sass-middleware` package, while also deprecated due to its reliance on `node-sass` (LibSass), is a more recent alternative that still faced similar end-of-life issues. This package offers no current release cadence and no active development, making it unsuitable for any new or existing projects.","status":"abandoned","version":"0.0.3","language":"javascript","source_language":"en","source_url":"git@github.com:blackbeam/sass-middleware","tags":["javascript","connect","express","sass","scss","middleware"],"install":[{"cmd":"npm install sass-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add sass-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add sass-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This middleware acts as a wrapper for the `sass` executable provided by the Ruby Sass gem, which must be installed globally on the system for the package to function. This is an external, non-npm dependency.","package":"sass (Ruby Gem)","optional":false}],"imports":[{"note":"This package is CommonJS-only and does not support ES Modules due to its age.","wrong":"import sassMiddleware from 'sass-middleware';","symbol":"middleware","correct":"const sassMiddleware = require('sass-middleware');"},{"note":"The module exports a function directly, not an object with a default property.","wrong":"app.use(sassMiddleware.default(...));","symbol":"options","correct":"app.use(require('sass-middleware')({\n  src: path.join(__dirname, 'public'),\n  dest: path.join(__dirname, 'public'),\n  debug: true\n}));"}],"quickstart":{"code":"const express = require('express');\nconst path = require('path');\nconst sassMiddleware = require('sass-middleware');\nconst app = express();\n\n// Ensure `sass` Ruby gem is installed: `gem install sass`\n\napp.use(sassMiddleware({\n  src: path.join(__dirname, 'public'),\n  dest: path.join(__dirname, 'public'),\n  debug: true, // Output compilation errors to console\n  outputStyle: 'expanded', // 'compressed', 'nested', 'compact', 'expanded'\n  prefix: '/stylesheets' // Where .scss files are served from, e.g., /stylesheets/style.css\n}));\n\napp.use(express.static(path.join(__dirname, 'public')));\n\napp.get('/', (req, res) => {\n  res.send('<h1>Sass Middleware Example</h1><link rel=\"stylesheet\" href=\"/stylesheets/style.css\">');\n});\n\napp.listen(3000, () => {\n  console.log('Server running on http://localhost:3000');\n  console.log('Ensure you have `gem install sass` run in your environment.');\n  console.log('Create public/stylesheets/style.scss and refresh your browser.');\n});\n\n// Example public/stylesheets/style.scss content:\n// $font-stack: Helvetica, sans-serif;\n// $primary-color: #333;\n//\n// body {\n//   font: 100% $font-stack;\n//   color: $primary-color;\n// }","lang":"javascript","description":"This quickstart demonstrates how to integrate `sass-middleware` into an Express application for on-the-fly SASS compilation, requiring the deprecated Ruby Sass gem."},"warnings":[{"fix":"Migrate to a modern SASS compilation workflow using Dart Sass (the `sass` npm package) as part of a build step (e.g., Webpack, Vite, Gulp) rather than on-the-fly middleware. Consider `node-sass-middleware` as a legacy alternative if `node-sass` is unavoidable, though `node-sass` itself is also deprecated.","message":"This package (`sass-middleware` version 0.0.3) is definitively abandoned and unmaintained. It relies on the Ruby Sass compiler, which is deprecated and has reached end-of-life. It is highly unlikely to function correctly with modern Node.js or Express/Connect versions and should not be used in production.","severity":"breaking","affected_versions":">=0.0.3"},{"fix":"Verify `gem install sass` has been successfully executed and the `sass` executable is in your system's PATH. However, the recommended fix is to avoid this package entirely due to its abandoned status.","message":"The middleware explicitly requires the `sass` Ruby gem to be installed globally on the system. This introduces a non-JavaScript dependency managed by RubyGems, not npm, which can lead to complex setup and compatibility issues across different development environments.","severity":"gotcha","affected_versions":">=0.0.3"},{"fix":"Always check the package name and its dependencies carefully. For modern SASS compilation, use the official `sass` npm package (Dart Sass) directly in your build process.","message":"There is a separate, similarly named package `node-sass-middleware` (version 1.1.0) which relies on `node-sass` (LibSass). While newer, `node-sass` is also deprecated, and `node-sass-middleware` is also archived and unmaintained. Ensure you are not confusing the two, but neither is recommended for new development.","severity":"gotcha","affected_versions":">=0.0.3"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure the Ruby `sass` gem is installed by running `gem install sass` and that your system's PATH variable includes the directory where RubyGems installs executables.","cause":"The middleware could not locate the `sass` command-line executable provided by the Ruby Sass gem in the system's PATH. This is a common issue because the package relies on an external, non-npm dependency.","error":"Error: `sass` executable not found."},{"fix":"Invoke the `sass-middleware` module with an options object, even if it's empty: `app.use(require('sass-middleware')({}));`","cause":"This error can occur if `require('sass-middleware')` is called without the `(options)` argument, as the module exports a function that expects to be invoked with options to return the actual middleware.","error":"TypeError: app.use() requires a middleware function but got a Object"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}