{"id":19549110,"url":"https://github.com/bsfishy/sass_extract","last_synced_at":"2026-05-01T21:02:25.904Z","repository":{"id":183511614,"uuid":"670285060","full_name":"BSFishy/sass_extract","owner":"BSFishy","description":"A tool to extract Sass variables from a file","archived":false,"fork":false,"pushed_at":"2023-07-31T17:39:26.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T06:54:06.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/BSFishy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-07-24T17:46:36.000Z","updated_at":"2024-03-09T21:36:06.000Z","dependencies_parsed_at":"2025-02-26T06:30:35.395Z","dependency_job_id":"b4ffa198-4f28-4721-983c-95e281133d46","html_url":"https://github.com/BSFishy/sass_extract","commit_stats":null,"previous_names":["bsfishy/sass_extract"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/BSFishy/sass_extract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BSFishy%2Fsass_extract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BSFishy%2Fsass_extract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BSFishy%2Fsass_extract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BSFishy%2Fsass_extract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BSFishy","download_url":"https://codeload.github.com/BSFishy/sass_extract/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BSFishy%2Fsass_extract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32512670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T03:57:56.886Z","updated_at":"2026-05-01T21:02:25.874Z","avatar_url":"https://github.com/BSFishy.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sass_extract\n\n[![License](https://img.shields.io/github/license/BSFishy/sass_extract)](LICENSE)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/BSFishy/sass_extract/build.yml?logo=github)](https://github.com/BSFishy/sass_extract/actions/workflows/build.yml)\n[![NPM Version](https://img.shields.io/npm/v/sass-extract-dart?logo=npm)](https://www.npmjs.com/package/sass-extract-dart)\n\n`sass_extract` is a simple tool to extract Sass variables from source code.\n\n## Example\n\nGiven an input file:\n\n```scss\n@use 'sass:color';\n\n$primaryColor: #4C4CBF;\n$secondaryPalette: (\"dark\": #871245, \"medium\": #e01f73, \"light\": #ed78ab);\n$sizes: 10px, 12, 14px, 16, 18px;\n$gray: color.mix(#fff, #000, 60%);\n```\n\nResults in the following JSON:\n\n```json\n{\n  \"primaryColor\": \"#4C4CBF\",\n  \"secondaryPalette\": {\n    \"dark\": \"#871245\",\n    \"medium\": \"#e01f73\",\n    \"light\": \"#ed78ab\"\n  },\n  \"sizes\": [\n    \"10px\",\n    12.0,\n    \"14px\",\n    16.0,\n    \"18px\"\n  ],\n  \"gray\": \"#999999\"\n}\n```\n\n## History\n\nOriginally, there was the [`sass-extract`](https://www.npmjs.com/package/sass-extract) along with the [`sass-extract-js`](https://www.npmjs.com/package/sass-extract-js).\nCombined, those two offered the same functionality of this tool.\nHowever, they relied on the now deprecated [`node-sass`](https://www.npmjs.com/package/node-sass) sass implementation.\n\nSince the functionality was extremely useful, and given both it and the implementation of sass it was based off of were deprecated, I decided to try and find a replacement, so I could migrate to [`dart-sass`](https://www.npmjs.com/package/sass).\nHowever, there weren't any good options to migrate to.\nI decided to reimplement it using the Dart API from the [reference sass implementation](https://github.com/sass/dart-sass).\n\n## Installation\n\nTo install sass_extract, simply add it as a dev dependency for your project\n\n```commandline\n~$ npm install --save-dev sass-extract-dart\n# or if you use yarn\n~$ yarn add --dev sass-extract-dart\n```\n\nAlternatively, if you just want to use the command, you can install it globally\n\n```commandline\n~$ npm install --global sass-extract-dart\n```\n\n## Usage\n\n### API\n\nsass_extract exposes a small API to perform the extraction.\n\n```typescript\nimport { extractVariablesFromString } from 'sass-extract-dart';\n\nextractVariablesFromString('$variable: #000;');\n```\n\nThe `extractVariablesFromString` function also has an options parameter.\n\n```typescript\nconst contents = /* ... */;\n\nextractVariablesFromString(contents, {\n    path: __dirname + '/src',\n});\n```\n\n| name | required | description |\n| --- | --- | --- |\n| `path` | no | The path to search for imports in. This includes `@use`, `@import`, `@forward`, etc. |\n\n### Command\n\nInstalling sass_extract will also add a command with the same name.\n\n```commandline\n~$ sass_extract -o output.json input.scss\n```\n\nThis command is a wrapper around the `extractVariablesFromString` function, which automatically reads the input file, determines a `path`, and writes it to an output file.\nBy default, the output file is the same as the input file, but with a `.json` extension.\n\n#### License\n\n\u003csup\u003e\nLicensed under \u003ca href=\"LICENSE\"\u003eMIT license\u003c/a\u003e.\n\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsfishy%2Fsass_extract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsfishy%2Fsass_extract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsfishy%2Fsass_extract/lists"}