{"id":18269749,"url":"https://github.com/yarastqt/postcss-theme-fold","last_synced_at":"2025-04-04T23:31:27.039Z","repository":{"id":36526162,"uuid":"226277410","full_name":"yarastqt/postcss-theme-fold","owner":"yarastqt","description":"Postcss plugin for folding css-variables with using whitepaper design system in legacy browsers.","archived":false,"fork":false,"pushed_at":"2021-12-11T08:57:37.000Z","size":687,"stargazers_count":5,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T20:18:48.184Z","etag":null,"topics":["css-variables","postcss","postcss-plugin","whitepaper"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yarastqt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-06T08:07:08.000Z","updated_at":"2022-05-04T08:23:07.000Z","dependencies_parsed_at":"2022-07-15T20:17:17.245Z","dependency_job_id":null,"html_url":"https://github.com/yarastqt/postcss-theme-fold","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarastqt%2Fpostcss-theme-fold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarastqt%2Fpostcss-theme-fold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarastqt%2Fpostcss-theme-fold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarastqt%2Fpostcss-theme-fold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yarastqt","download_url":"https://codeload.github.com/yarastqt/postcss-theme-fold/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266476,"owners_count":20910831,"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":["css-variables","postcss","postcss-plugin","whitepaper"],"created_at":"2024-11-05T11:37:03.258Z","updated_at":"2025-04-04T23:31:26.616Z","avatar_url":"https://github.com/yarastqt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-theme-fold [\u003cimg src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS\" width=\"90\" height=\"90\" align=\"right\"\u003e][postcss]\n\n[![NPM Version][npm-img]][npm-url] [![github (ci)][github-ci]][github-ci]\n\nPostcss plugin for folding css-variables with using [whitepaper](whitepaper) design system in legacy browsers.\n\n## Install\n\n```sh\nnpm i -D postcss-theme-fold\n```\n\n## Usage\n\n```js\nconst { resolve } = require('path')\nconst postcss = require('postcss')\nconst themeFold = require('postcss-theme-fold')\n\npostcss([\n  themeFold({\n    mode: 'multi-themes',\n    themes: [\n      [\n        resolve('src/components/Theme/_size/Theme_color_default.css'),\n        resolve('src/components/Theme/_size/Theme_size_default.css'),\n      ],\n      [\n        resolve('src/components/Theme/_size/Theme_color_brand.css'),\n        resolve('src/components/Theme/_size/Theme_size_default.css'),\n      ],\n    ],\n    globalSelectors: ['.utilityfocus'],\n  }),\n])\n  .process(css, { from: cssPath })\n  .then(result =\u003e result.css)\n```\n\n### Options\n\n* **themes (string[][])**: List of themes with path to css files.\n* **globalSelectors (string[])**: Global helper-selectors.\n* **mode ('single-theme' | 'multi-themes')**: Method of theme folding, by default choice mode in relation from themes size. `single-theme` — don't accumulate cascade with theme selectors. `multi-themes` — accumulate cascade with theme selectors.\n* **shouldProcessVariable (declaration: Declaration) =\u003e boolean**: Predicate for processing each nodes.\n* **disableWarnings**: Disable warnings about missing values\n* **debug**: Show original variables as comment\n* **preserve:** Preserve original declaration\n\n### Example content\n\n#### input:\n\n```css\n/* Theme/_color/Theme_color_default.css */\n.Theme_color_default {\n  --color: #fff;\n}\n\n/* Theme/_size/Theme_size_default.css */\n.Theme_size_default {\n  --size: 10px;\n}\n\n/* Button/Button.css */\n.Button {\n  color: var(--color);\n  font-size: var(--size);\n  box-sizing: border-box;\n}\n```\n\n#### output:\n\nSplit rules from other chunks of theme to extra selectors for order to reduce the specificity.\n\n```css\n.Button {\n  box-sizing: border-box;\n}\n\n.Theme_color_default .Button {\n  color: #fff;\n}\n\n.Theme_size_default .Button {\n  font-size: 10px;\n}\n```\n\n## Know issues\n\n[npm-img]: https://img.shields.io/npm/v/postcss-theme-fold.svg\n[npm-url]: https://www.npmjs.com/package/postcss-theme-fold\n[github-ci]: https://github.com/yarastqt/postcss-theme-fold/workflows/ci/badge.svg?branch=master\n\n[whitepaper]: http://whitepaper.tools\n[PostCSS]: https://github.com/postcss/postcss\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarastqt%2Fpostcss-theme-fold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyarastqt%2Fpostcss-theme-fold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarastqt%2Fpostcss-theme-fold/lists"}