{"id":16124034,"url":"https://github.com/itaditya/tw-universal-tokens","last_synced_at":"2025-03-16T08:32:54.043Z","repository":{"id":57382529,"uuid":"330635707","full_name":"itaditya/tw-universal-tokens","owner":"itaditya","description":"Use Tailwind tokens as CSS variables, SASS map, SASS variables, ES module, JSON \u0026 Common JS module.","archived":false,"fork":false,"pushed_at":"2021-01-18T23:32:55.000Z","size":431,"stargazers_count":69,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T14:33:52.725Z","etag":null,"topics":["tailwindcss"],"latest_commit_sha":null,"homepage":"https://tw-tokens.netlify.app/","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/itaditya.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}},"created_at":"2021-01-18T10:49:00.000Z","updated_at":"2024-08-15T10:00:08.000Z","dependencies_parsed_at":"2022-09-01T04:40:29.917Z","dependency_job_id":null,"html_url":"https://github.com/itaditya/tw-universal-tokens","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Ftw-universal-tokens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Ftw-universal-tokens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Ftw-universal-tokens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itaditya%2Ftw-universal-tokens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itaditya","download_url":"https://codeload.github.com/itaditya/tw-universal-tokens/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809865,"owners_count":20351403,"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":["tailwindcss"],"created_at":"2024-10-09T21:19:32.620Z","updated_at":"2025-03-16T08:32:53.595Z","avatar_url":"https://github.com/itaditya.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://tw-tokens.netlify.app/preview-tw-tokens.jpg)\n\n# Universal Tokens for Tailwind\n\nMany people wish to use Tailwind's hand-crafted design tokens but don't want to adapt Utility CSS approach. This package provides all the tokens as\n\n### 1. CSS variables\n\nImport the CSS file in your bundle. For webpack this works—\n\n```js\nimport 'tw-universal-tokens/dist/css/theme.css';\n```\n\nThis will add all the Tailwind design tokens on `:root`. Then just use them in your CSS file—\n\n```css\n.card {\n  padding: var(--tw-spacing-4) var(--tw-spacing-8);\n  min-width: var(--tw-spacing-24);\n  background-color: var(--tw-color-green-100);\n  border-radius: var(--tw-rounded-md);\n  box-shadow: var(--tw-shadow-lg);\n}\n```\n\n[List of all CSS variables](https://github.com/itaditya/tw-universal-tokens/blob/master/packages/core/dist/css/theme.css)\n\n### 2. SASS variables\n\nUse the SCSS partial in your SCSS file like this—\n\n```scss\n@import 'tw-universal-tokens/dist/scss/theme_variables';\n\n.card {\n  padding: $tw-spacing-4 $tw-spacing-8;\n  min-width: $tw-spacing-24;\n  background-color: $tw-color-green-100;\n  border-radius: $tw-rounded-md;\n  box-shadow: $tw-shadow-lg;\n}\n```\n\n[List of all SCSS variables](https://github.com/itaditya/tw-universal-tokens/blob/master/packages/core/dist/scss/_theme_variables.scss)\n\n### 3. SASS map\n\nUse the SCSS partial in your SCSS file like this—\n\n```scss\n@import 'tw-universal-tokens/dist/scss/theme_map';\n\n.card {\n  padding: map-get($tw-tokens, 'spacing-4') map-get($tw-tokens, 'spacing-8');\n  min-width: map-get($tw-tokens, 'spacing-24');\n  background-color: map-get($tw-tokens, 'color-green-100');\n  border-radius: map-get($tw-tokens, 'rounded-md');\n  box-shadow: map-get($tw-tokens, 'shadow-lg');\n}\n```\n\n[Content of the SCSS map](https://github.com/itaditya/tw-universal-tokens/blob/master/packages/core/dist/scss/_theme_map.scss)\n\n### 4. ES Module\n\nImport the required tokens from the package—\n\n```js\nimport { Spacing4, Spacing8, Spacing24, ColorGreen100, RoundedLg, ShadowLg } from 'tw-universal-tokens';\n```\n\nThen use them in style attribute like this—\n\n```js\nconst regularStyles = {\n  padding: `${Spacing4} ${Spacing8}`,\n  minWidth: Spacing24,\n  backgroundColor: ColorGreen100,\n  borderRadius: RoundedMd,\n  boxShadow: ShadowLg,\n};\n\n\u003cCard style={regularStyles} /\u003e\n```\n\nSimilarly for CSS in JS libraries do this—\n\n```js\nconst emotionStyles = css`\n  padding: ${Spacing4} ${Spacing8},\n  min-width: ${Spacing24},\n  background-color: ${ColorGreen100},\n  border-radius: ${RoundedMd},\n  box-shadow: ${ShadowLg},\n`;\n\n\u003cCard css={regularStyles} /\u003e\n```\n\n[List of all exports in ES module](https://github.com/itaditya/tw-universal-tokens/blob/master/packages/core/dist/esm/theme.js)\n\n### 5. JSON file\n\nA JSON file is also available. In case you need it import from—\n\n```\n\"tw-universal-tokens/dist/json/theme.json\"\n```\n\n[Content of JSON file](https://github.com/itaditya/tw-universal-tokens/blob/master/packages/core/dist/json/theme.json)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitaditya%2Ftw-universal-tokens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitaditya%2Ftw-universal-tokens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitaditya%2Ftw-universal-tokens/lists"}