{"id":15041265,"url":"https://github.com/sass/node-sass-middleware","last_synced_at":"2025-05-16T11:05:29.932Z","repository":{"id":15553577,"uuid":"18288647","full_name":"sass/node-sass-middleware","owner":"sass","description":"connect middleware extracted from node-sass","archived":false,"fork":false,"pushed_at":"2024-05-11T09:13:26.000Z","size":198,"stargazers_count":262,"open_issues_count":8,"forks_count":85,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-09T00:28:52.050Z","etag":null,"topics":["middleware","node-sass","sass-middleware"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-03-31T09:48:01.000Z","updated_at":"2024-10-09T11:24:45.000Z","dependencies_parsed_at":"2024-12-15T07:04:15.886Z","dependency_job_id":"2d6af4b5-9bb9-48ba-84c1-ba20d5b8c30a","html_url":"https://github.com/sass/node-sass-middleware","commit_stats":{"total_commits":165,"total_committers":39,"mean_commits":4.230769230769231,"dds":0.703030303030303,"last_synced_commit":"5d2559ddab22fbe45a77c07ff7061711e7445b3a"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sass%2Fnode-sass-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sass%2Fnode-sass-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sass%2Fnode-sass-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sass%2Fnode-sass-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sass","download_url":"https://codeload.github.com/sass/node-sass-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254303466,"owners_count":22048206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["middleware","node-sass","sass-middleware"],"created_at":"2024-09-24T20:45:50.356Z","updated_at":"2025-05-16T11:05:29.912Z","avatar_url":"https://github.com/sass.png","language":"JavaScript","readme":"# node-sass-middleware\n\n\u003e [!WARNING]\n[LibSass, Node Sass and this middleware are deprecated](https://sass-lang.com/blog/libsass-is-deprecated).\nWhile they will continue to receive maintenance releases indefinitely, there are no\nplans to add additional features or compatibility with any new CSS or Sass features.\nProjects that still use it should move onto\n[Dart Sass](https://sass-lang.com/dart-sass).\n\nConnect/Express middleware for [node-sass](https://github.com/sass/node-sass).\n\n[![Main CI Workflow](https://github.com/sass/node-sass-middleware/actions/workflows/ci.yml/badge.svg)](https://github.com/sass/node-sass-middleware/actions/workflows/ci.yml)\n[![npm version](https://badge.fury.io/js/node-sass-middleware.svg)](http://badge.fury.io/js/node-sass-middleware)\n[![Gitter chat](http://img.shields.io/badge/gitter-sass/node--sass-brightgreen.svg)](https://gitter.im/sass/node-sass)\n\n## Install\n\n```bash\nnpm install node-sass-middleware\n```\n\n## Usage\n\nRecompile `.scss` or `.sass` files automatically for connect and express based http servers.\n\n### Connect example\n\n```javascript\nconst connect = require('connect')\nconst sassMiddleware = require('node-sass-middleware')\nconst server = connect.createServer(\n  sassMiddleware({\n      /* Options */\n      src: __dirname\n    , dest: __dirname + '/public'\n    , debug: true\n    , outputStyle: 'compressed'\n    , prefix:  '/prefix'  // Where prefix is at \u003clink rel=\"stylesheets\" href=\"prefix/style.css\"/\u003e\n  }),\n  connect.static('/prefix', __dirname + '/public')\n);\n```\n\nThere is an example connect app here: \u003chttps://github.com/andrew/node-sass-example\u003e\n\nHeavily inspired by \u003chttps://github.com/LearnBoost/stylus\u003e\n\n### Express example\n\n```javascript\nconst express = require('express');\nconst sassMiddleware = require('node-sass-middleware');\nconst path = require('path');\nconst app = express();\napp.use(sassMiddleware({\n    /* Options */\n    src: __dirname,\n    dest: path.join(__dirname, 'public'),\n    debug: true,\n    outputStyle: 'compressed',\n    prefix:  '/prefix'  // Where prefix is at \u003clink rel=\"stylesheets\" href=\"prefix/style.css\"/\u003e\n}));\n// Note: you must place sass-middleware *before* `express.static` or else it will\n// not work.\napp.use('/public', express.static(path.join(__dirname, 'public')));\n```\n\n### Connect with other middleware example\n\n```javascript\nconst connect = require('connect');\nconst sassMiddleware = require('node-sass-middleware');\nconst postcssMiddleware = require('postcss-middleware');\nconst autoprefixer = require('autoprefixer');\nconst path = require('path');\nconst http = require('http');\nconst app = connect();\nconst destPath = __dirname + '/public';\napp.use(sassMiddleware({\n    /* Options */\n    src: __dirname\n  , response: false\n  , dest: destPath\n  , outputStyle: 'extended'\n}));\napp.use(postcssMiddleware({\n  plugins: [\n    /* Plugins */\n    autoprefixer({\n      /* Options */\n    })\n  ],\n  src: function(req) {\n    return path.join(destPath, req.url);\n  }\n}));\n\nhttp.createServer(app).listen(3000);\n```\n\n### Options\n\n* `src`            - (String) Source directory used to find `.scss` or `.sass` files.\n\n#### Optional configurations\n\n* `beepOnError`    - Enable beep on error, false by default.\n* `debug`          - `[true | false]`, false by default. Output debugging information.\n* `dest`           - (String) Destination directory used to output `.css` files (when undefined defaults to `src`).\n* `error`          - A function to be called when something goes wrong.\n* `force`          - `[true | false]`, false by default. Always re-compile.\n* `indentedSyntax` - `[true | false]`, false by default. If true compiles files with the `.sass` extension instead of `.scss` in the `src` directory.\n* `log`            - `function(severity, key, val, message)`, used to log data instead of the default `console.error`. \"severity\" matches [Winston](https://www.npmjs.com/package/winston) severity levels.\n* `maxAge`         - MaxAge to be passed in Cache-Control header.\n* `prefix`         - (String) It will tell the sass middleware that any request file will always be prefixed with `\u003cprefix\u003e` and this prefix should be ignored.\n* `response`       - `[true | false]`, true by default. To write output directly to response instead of to a file.\n* `root`           - (String) A base path for both source and destination directories.\n\n  For full list of options from original node-sass project go [here](https://github.com/sass/node-sass).\n\n### Express example with custom log function\n\n```javascript\nconst express = require('express');\nconst sassMiddleware = require('node-sass-middleware');\nconst path = require('path');\nconst winston = require('winston');\nconst app = express();\nwinston.level = 'debug';\napp.use(sassMiddleware({\n    /* Options */\n    src: __dirname,\n    dest: path.join(__dirname, 'public'),\n    debug: true,\n    log: function (severity, key, value) { winston.log(severity, 'node-sass-middleware   %s : %s', key, value); }\n}));\n// Note: you must place sass-middleware *before* `express.static` or else it will\n// not work.\napp.use(express.static(path.join(__dirname, 'public')));\n```\n\n## Contributors\n\nWe \u003c3 our contributors! A special thanks to all those who have clocked in some dev time on this project, we really appreciate your hard work. You can find [a full list of those people here](https://github.com/sass/node-sass-middleware/graphs/contributors).\n\n### Building and Testing\n\n```sh\ngit clone git@github.com:sass/node-sass-middleware\ncd node-sass-middleware\n\nnpm install\nnpm test\n```\n\n### Note on Patches/Pull Requests\n\n* Fork the project.\n* Make your feature addition or bug fix.\n* Add documentation if necessary.\n* Add tests for it. This is important so I don't break it in a future version unintentionally.\n* Send a pull request. Bonus points for topic branches.\n\n## Copyright\n\nCopyright (c) 2013+ Andrew Nesbitt. See [LICENSE](https://github.com/sass/node-sass-middleware/blob/master/LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsass%2Fnode-sass-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsass%2Fnode-sass-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsass%2Fnode-sass-middleware/lists"}