{"id":18331,"library":"express-dart-sass","title":"express-dart-sass","description":"Express middleware for dart-sass (the primary Sass implementation, now deprecated in favor of the new JS API). Version 1.0.4 is the latest stable release (last updated in 2021). It recompiles .scss/.sass files automatically for Express-based HTTP servers. Key differentiators: uses dart-sass (which is faster and more feature-complete than node-sass), supports legacy options like outputStyle, prefix, and error handling. The package is in maintenance mode due to the deprecation of the legacy JS API (LibSass/Node Sass) and the move to the new embedded dart-sass API.","status":"maintenance","version":"1.0.4","language":"javascript","source_language":"en","source_url":"git://github.com/Colbyjdx/express-dart-sass","tags":["javascript","express","middleware","sass","dart-sass","scss","css"],"install":[{"cmd":"npm install express-dart-sass","lang":"bash","label":"npm"},{"cmd":"yarn add express-dart-sass","lang":"bash","label":"yarn"},{"cmd":"pnpm add express-dart-sass","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The middleware is designed to work with Express; it uses Express-style request/response objects.","package":"express","optional":false},{"reason":"dart-sass (the sass npm package) is required for compiling Sass files.","package":"sass","optional":false}],"imports":[{"note":"This package is CommonJS only; it does not provide ESM exports. Use require().","wrong":"import sassMiddleware from 'express-dart-sass';","symbol":"default","correct":"const sassMiddleware = require('express-dart-sass');"},{"note":"The package's module field points to an ESM wrapper? Actually it's CJS; some bundlers allow default import. Named import does not exist.","wrong":"import { sass } from 'express-dart-sass';","symbol":"default (ESM style)","correct":"import sassMiddleware from 'express-dart-sass';\n// Works only if your project is configured for ESM interop."},{"note":"The package does not ship TypeScript declarations. Use @types/express-dart-sass? There are none.","wrong":"import { Options } from 'express-dart-sass';","symbol":"Options interface","correct":"// No type exports; define your own interface based on docs"}],"quickstart":{"code":"const express = require('express');\nconst sassMiddleware = require('express-dart-sass');\nconst path = require('path');\nconst app = express();\n\napp.use(sassMiddleware({\n    src: __dirname,\n    dest: path.join(__dirname, 'public'),\n    debug: true,\n    outputStyle: 'compressed',\n    prefix: '/prefix'\n}));\n\napp.use(express.static(path.join(__dirname, 'public')));\n\napp.listen(3000, () => console.log('Server running on port 3000'));","lang":"javascript","description":"Sets up express-dart-sass middleware to compile SCSS files from src to dest with compressed output, then serves static files."},"warnings":[{"fix":"Consider migrating to sass (dart-sass) direct integration or use the new compile API in your own middleware.","message":"The dart-sass legacy JS API (used by this middleware) is deprecated in favor of the new compile() API.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure app.use(sassMiddleware(...)) precedes app.use(express.static(...)).","message":"Middleware must be placed before express.static to serve compiled CSS.","severity":"gotcha","affected_versions":"all"},{"fix":"Always specify dest or use response: true if you don't need file output.","message":"The 'dest' option is required; if omitted, compiled files may overwrite source .scss files (since default is src).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install sass --save","cause":"The package depends on dart-sass (the `sass` npm package) which is not installed.","error":"Error: Cannot find module 'sass'"},{"fix":"Use `const sassMiddleware = require('express-dart-sass')` or enable esModuleInterop in tsconfig.","cause":"CommonJS require returns an object with a default property when using ESM-style import in a CJS environment? Actually, the package exports a function directly, but if you use `import sassMiddleware from 'express-dart-sass'` in a TypeScript project with esModuleInterop: false, it may cause issues.","error":"TypeError: sassMiddleware is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}