{"id":27888668,"url":"https://github.com/dcwither/scss-codemods","last_synced_at":"2025-05-05T09:22:59.698Z","repository":{"id":56466712,"uuid":"298908276","full_name":"dcwither/scss-codemods","owner":"dcwither","description":"SCSS codemods written with postcss plugins","archived":false,"fork":false,"pushed_at":"2020-11-07T03:59:19.000Z","size":699,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T09:22:49.495Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/dcwither.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-26T22:15:34.000Z","updated_at":"2022-09-19T10:40:45.000Z","dependencies_parsed_at":"2022-08-15T19:20:20.158Z","dependency_job_id":null,"html_url":"https://github.com/dcwither/scss-codemods","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwither%2Fscss-codemods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwither%2Fscss-codemods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwither%2Fscss-codemods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwither%2Fscss-codemods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcwither","download_url":"https://codeload.github.com/dcwither/scss-codemods/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252470808,"owners_count":21753052,"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":[],"created_at":"2025-05-05T09:22:58.610Z","updated_at":"2025-05-05T09:22:59.684Z","avatar_url":"https://github.com/dcwither.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scss-codemods\n\nThis project uses postcss to refactor scss code to conform to lint rules that are intended to improve grepability/readability.\n\n## Installation\n\n### Globally via `npm`\n\n```sh\nnpm i -g scss-codemods\n```\n\n### Running on-demand\n\n```\nnpx scss-codemods [command] [options]\n```\n\n## `union-class-name`\n\n\"Promotes\" CSS classes that have the `\u0026-` nesting union selector. Attempts to fix issues flagged by [scss/no-union-class-name](https://github.com/kristerkari/stylelint-scss/blob/master/src/rules/selector-no-union-class-name/README.md) stylelint rule. \n\ne.g.\n\n```scss\n.rule {\n  \u0026-suffix {\n    color: blue;\n  }\n}\n\n// becomes\n\n.rule-suffix {\n  color: blue;\n}\n```\n\nIntended to improve \"grepability\" of the selectors that are produced in the browser.\n\n### Usage\n\n```bash\nscss-codemods union-class-name --reorder never \u003cfiles\u003e\n```\n\n### Options\n\n#### `--reorder`\n\nDetermines the freedom provided to the codemod to reorder rules to better match the desired format (default: `never`).\n\n\n**Values:**\n- `never`: won't promote rules if it would result in the reordering of selectors.\n- `safe-only`: will promote rules that result in the reordering of selectors as long as the reordered selectors don't have the same specificity.\n- `allow-unsafe`: will promote rules regardless of reordering, could result in differing styles if both classes are used on the same element and there's conflicting properties.\n\n*Recommended that you test the resulting css thoroughly, especially with the `allow-unsafe` option.*\n\n#### `--promote-dollar-vars`\n\nDetermines how dollar vars will be promoted (default: `global`). **not implemented**\n\n**Values:**\n- `no-global`: won't promote a dollar var to global context, prevents some rules from being promoted.\n- `global`: allows promoting dollar vars to global\n\n#### Not Implemented: `--namespace-dollar-vars`\n\nDetermines how dollar var promotion namespacing behavior (default: `never`).\n\n- `never`: will promote a dollar var as necessary, will fail if there are duplicate vars at the same level as the promoted var.\n- `when-necessary`: will namespace a dollar var with the classname it was promoted out of, will still fail if there is a duplicate promoted var.\n- `always`: will always namespace dollar vars with the classname \n\n## `hex-to-tokens`\n\nReplaces hex colors with tokens defined in a config. Allows for close matches through use of [Delta E](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000) color distance algorithm.\n\ne.g.\n\n```\n.rule {\n  color: #0000FF\n}\n\n// becomes\n\n.rule {\n  color: $blue;\n}\n```\n\n### Usage\n\n```bash\nscss-codemods hex-to-tokens --config tokens.json \u003cfiles\u003e\n```\n\n### Options\n\n#### `--config`\n\nPath to a `json` file with the following format:\n```json\n[\n  {\n    \"hex\": \"#ffffff\",\n    \"name\": \"$white\"\n  },\n  {\n\n    \"hex\": \"#f8f9fa\",\n    \"name\": \"$gray-100\"\n  },\n  ...\n]\n```\n\n#### `--threshold`\n\nA number within the range [0, 100] representing the Delta E [threshold](http://zschuessler.github.io/DeltaE/learn/#toc-defining-delta-e) for color matches (default: `0`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcwither%2Fscss-codemods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcwither%2Fscss-codemods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcwither%2Fscss-codemods/lists"}