{"id":19716513,"url":"https://github.com/dawaltconley/sass-cast","last_synced_at":"2026-05-03T23:35:58.479Z","repository":{"id":81381626,"uuid":"437433006","full_name":"dawaltconley/sass-cast","owner":"dawaltconley","description":"Convert Javascript objects to Sass objects and vice versa.","archived":false,"fork":false,"pushed_at":"2024-03-14T03:37:33.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-29T12:10:07.327Z","etag":null,"topics":["cast","converter","json","sass"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sass-cast","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dawaltconley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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":"2021-12-12T02:14:29.000Z","updated_at":"2024-01-11T12:52:07.000Z","dependencies_parsed_at":"2024-11-11T22:42:29.521Z","dependency_job_id":"1056618f-d8ed-45fc-8c38-eccebba87871","html_url":"https://github.com/dawaltconley/sass-cast","commit_stats":{"total_commits":74,"total_committers":1,"mean_commits":74.0,"dds":0.0,"last_synced_commit":"23bd02c4451dfc8c73ffbedbfb5c020ada22302d"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/dawaltconley/sass-cast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawaltconley%2Fsass-cast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawaltconley%2Fsass-cast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawaltconley%2Fsass-cast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawaltconley%2Fsass-cast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dawaltconley","download_url":"https://codeload.github.com/dawaltconley/sass-cast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawaltconley%2Fsass-cast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32589262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cast","converter","json","sass"],"created_at":"2024-11-11T22:42:25.212Z","updated_at":"2026-05-03T23:35:58.454Z","avatar_url":"https://github.com/dawaltconley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sass-cast\n\nConvert Javascript objects to Sass objects and vice versa. Based on `sassport`\nand `node-sass-utils`, updated to work with newer sass versions and the [modern\nSass API](https://sasscss.org/blog/new-js-api-release-candidate).\n\n## Usage\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n*   [toSass](#tosass)\n    *   [Parameters](#parameters)\n    *   [Examples](#examples)\n*   [fromSass](#fromsass)\n    *   [Parameters](#parameters-1)\n    *   [Examples](#examples-1)\n*   [sassFunctions](#sassfunctions)\n    *   [Examples](#examples-2)\n    *   [require](#require)\n        *   [Examples](#examples-3)\n        *   [Parameters](#parameters-2)\n*   [legacy](#legacy)\n    *   [toSass](#tosass-1)\n        *   [Parameters](#parameters-3)\n    *   [fromSass](#fromsass-1)\n        *   [Parameters](#parameters-4)\n    *   [sassFunctions](#sassfunctions-1)\n        *   [require](#require-1)\n            *   [Parameters](#parameters-5)\n\n### toSass\n\nConverts any Javascript object to an equivalent Sass value.\n\nThis method is recursive and will convert the values of any array or object,\nas well as the array or object itself.\n\n#### Parameters\n\n*   `value` **any** the value to be converted\n*   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n\n    *   `options.parseUnquotedStrings` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** whether to parse unquoted strings for colors or numbers with units (optional, default `false`)\n    *   `options.resolveFunctions` **([boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cany\u003e)** if true, resolve functions and attempt to cast their return values. if an array, pass as arguments when resolving (optional, default `false`)\n    *   `options.quotes` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** controls whether returned SassStrings are quoted. input strings that contain quotes will always return a quoted SassString even if this flag is false. (optional, default `true`)\n\n#### Examples\n\n```javascript\nconst { toSass } = require('sass-cast');\n\nconst string = toSass('a simple string');\n// quoted SassString =\u003e '\"a simple string\"'\n\nconst map = toSass({\n  key: 'value',\n  nested: {\n    'complex//:key': [ null, 4 ],\n  }\n});\n// SassMap =\u003e '(\"key\": \"value\", \"nested\": (\"complex//:key\": (null, 4)))'\n```\n\nReturns **Value** a [Sass value](https://sass-lang.com/documentation/js-api/classes/Value)\n\n### fromSass\n\nConverts Sass values to their Javascript equivalents.\n\n#### Parameters\n\n*   `object` **Value** a [Sass value](https://sass-lang.com/documentation/js-api/classes/Value)\n*   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n\n    *   `options.preserveUnits` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** By default, only the values of numbers are returned, not their units. If true, `fromSass` will return numbers as a two-item Array, i.e. \\[ value, unit ] (optional, default `false`)\n    *   `options.rgbColors` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** By default, colors are returned as strings. If true, `fromSass` will return colors as an object with `r`, `g`, `b`, and `a`, properties. (optional, default `false`)\n    *   `options.preserveQuotes` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** By default, quoted Sass strings return their inner text as a string. If true, `fromSass` will preserve the quotes in the returned string value. (optional, default `false`)\n\n#### Examples\n\n```javascript\nconst { fromSass, toSass } = require('sass-cast');\n\nconst sassString = toSass('a sass string object');\nconst string = fromSass(sassString);\n// 'a sass string object'\n```\n\nReturns **any** a Javascript value corresponding to the Sass input\n\n### sassFunctions\n\nAn object defining Sass utility functions.\n\n#### Examples\n\nPass to sass using the JS API\n\n```javascript\nconst { sassFunctions } = require('sass-cast');\nconst sass = require('sass');\n\nsass.compile('main.scss', { functions: sassFunctions });\n```\n\n#### require\n\nSass function for importing data from Javascript or JSON files.\nCalls the CommonJS `require` function under the hood.\n\n##### Examples\n\n```scss\n// import config info from tailwindcss\n$tw: require('./tailwind.config.js', $parseUnquotedStrings: true);\n$tw-colors: map.get($tw, theme, extend, colors);\n```\n\n##### Parameters\n\n*   `$module` **SassString** Path to the file or module. Relative paths are relative to the Node process running Sass compilation.\n*   `$properties` **SassList** List of properties, if you only want to parse part of the module data. (optional, default `()`)\n*   `$parseUnquotedStrings` **SassBoolean** Passed as an option to [toSass](#tosass). (optional, default `false`)\n*   `$resolveFunctions` **SassBoolean** Passed as an option to [toSass](#tosass). (optional, default `false`)\n*   `$quotes` **SassBoolean** Passed as an option to [toSass](#tosass). (optional, default `true`)\n\nReturns **Value** a [Sass value](https://sass-lang.com/documentation/js-api/classes/Value)\n\n### legacy\n\nIdentical methods that interface with Sass's legacy Javascript API for older versions of Sass. Use `require('sass-cast/legacy')`.\n\n#### toSass\n\nConverts any Javascript object to an equivalent legacy Sass object.\n\n##### Parameters\n\n*   `value` **any** the value to be converted\n*   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n\n    *   `options.parseUnquotedStrings` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** whether to parse unquoted strings for colors or numbers with units (optional, default `false`)\n    *   `options.resolveFunctions` **([boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cany\u003e)** if true, resolve functions and attempt to cast their return values. if an array, pass as arguments when resolving (optional, default `false`)\n    *   `options.quotes` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)** the type of quotes to use when quoting Sass strings (single or double) (optional, default `\"'\"`)\n\nReturns **LegacyObject** a [legacy Sass object](https://sass-lang.com/documentation/js-api/modules#LegacyValue)\n\n#### fromSass\n\nConverts legacy Sass objects to their Javascript equivalents.\n\n##### Parameters\n\n*   `object` **LegacyObject** a [legacy Sass object](https://sass-lang.com/documentation/js-api/modules#LegacyValue)\n*   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n\n    *   `options.preserveUnits` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** By default, only the values of numbers are returned, not their units. If true, `fromSass` will return numbers as a two-item Array, i.e. \\[ value, unit ] (optional, default `false`)\n    *   `options.rgbColors` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** By default, colors are returned as strings. If true, `fromSass` will return colors as an object with `r`, `g`, `b`, and `a`, properties. (optional, default `false`)\n    *   `options.preserveQuotes` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** By default, quoted Sass strings return their inner text as a string. If true, `fromSass` will preserve the quotes in the returned string value. (optional, default `false`)\n\nReturns **any** a Javascript value corresponding to the Sass input\n\n#### sassFunctions\n\n*   **See**: [sassFunctions](#sassfunctions)\n\nAn object defining legacy Sass utility functions.\n\n##### require\n\n*   **See**: [require](https://nodejs.org/api/globals.html#globals_require)\n\nLegacy Sass function for importing data from Javascript or JSON files.\n\n###### Parameters\n\n*   `$module`  \n*   `$properties`  \n*   `$parseUnquotedStrings`  \n*   `$resolveFunctions`  \n*   `$quotes`  \n*   `done`  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawaltconley%2Fsass-cast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdawaltconley%2Fsass-cast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawaltconley%2Fsass-cast/lists"}