{"id":23034962,"url":"https://github.com/regenrek/vue-ts-css-in-js-dark-mode-example","last_synced_at":"2025-04-02T22:22:27.782Z","repository":{"id":39073561,"uuid":"276071061","full_name":"regenrek/vue-ts-css-in-js-dark-mode-example","owner":"regenrek","description":"vue dark mode switcher with typescript, emotion, twin.macro (TailwindCSS css-in-js) and composition api example","archived":false,"fork":false,"pushed_at":"2022-12-13T04:47:04.000Z","size":1235,"stargazers_count":2,"open_issues_count":20,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T12:46:22.539Z","etag":null,"topics":[],"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/regenrek.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":"2020-06-30T10:43:14.000Z","updated_at":"2020-10-16T23:32:47.000Z","dependencies_parsed_at":"2023-01-28T07:01:19.972Z","dependency_job_id":null,"html_url":"https://github.com/regenrek/vue-ts-css-in-js-dark-mode-example","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/regenrek%2Fvue-ts-css-in-js-dark-mode-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regenrek%2Fvue-ts-css-in-js-dark-mode-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regenrek%2Fvue-ts-css-in-js-dark-mode-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/regenrek%2Fvue-ts-css-in-js-dark-mode-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/regenrek","download_url":"https://codeload.github.com/regenrek/vue-ts-css-in-js-dark-mode-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246900493,"owners_count":20852058,"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":"2024-12-15T16:37:03.512Z","updated_at":"2025-04-02T22:22:27.761Z","avatar_url":"https://github.com/regenrek.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vue + twin.macro\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.imgur.com/XQ5kwkc.jpg\" alt=\"emotion\" style=\"width:95%;display:block;max-width:100%\" /\u003e\u003cbr\u003e\n  \u003cbr\u003e\n  Vue + Twin CSS-in-js lib (TailwindCSS)\n    \u003cbr\u003e\n\u003c/p\u003e\n\n\n## Demo\n\nDark Mode Switcher included. Using composables as Theme Wrapper with provide/inject.\n\n\u003cimg src=\"https://i.imgur.com/cmDHVAh.gif\" style=\"width: 380px;display:block;max-width:100%\" /\u003e\n\n\u003cbr\u003e\n\nDemo Link: https://vuejs-ts-emotion-css-in-js.netlify.app\n\nThis is a WIP proof of concept to make use of different libraries. I don't recommend to use this anywhere in production.\n\n## Using\n\n* vue.js typescript\n* [vuejs/composition-api](https://github.com/vuejs/composition-api) (see [rfc](https://composition-api.vuejs.org/)) \n* [twin.macro](https://github.com/ben-rogerson/twin.macro) Use [TailwindCSS](https://tailwindcss.com/) within css-in-js\n* [@egoist/vue-emotion](https://github.com/regenrek/vue-emotion) emotion css-in-js\n* [babel jsx](https://github.com/vuejs/jsx) vue.js jsx support\n* [babel-preset-vca-jsx](https://github.com/luwanquan/babel-preset-vca-jsx) Automatically import `createElement as h` when writing `JSX`\n* [vue-unstated](https://github.com/resessh/vue-unstated) Automatically import `createElement as h` when writing `JSX`\n\n## How-To\n\nBasically all you can do with [twin.macro](https://github.com/ben-rogerson/twin.macro). Please see current [Limitations](#Limitations) \n\n\n```\n\n\n## Note\n\n* I've slightly adapted @egoist/vue-emotion: removed global theme injection so it works with vca local provide/inject.\n\n## Limitations\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003etwin.macro with TypeScript + emotion\u003c/b\u003e\n\u003c/summary\u003e\n\n❌\n```js\nimport tw, {css, styled } from `twin.macro`\n```\n\n✅     \n```js\nimport tw from 'twin.macro'\nimport { css } from 'emotion'\nimport { styled } from '@egoist/vue-emotion'\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eUse emotions `css` prop with twin.macro `tw` prop\u003c/b\u003e\n\u003c/summary\u003e\n\n❌\n```js\nconst style = tw`flex items-center justify-center bg-black min-h-screen`\n\n// ↓ ↓ ↓ ↓ ↓ ↓\n\n{\n  fontSize: '0.875rem',\n  '@media (min-width: 768px)': {\n    fontSize: '1.125rem',\n  },\n}\n```\n\n✅     \n```js\nconst style = css`${tw`flex items-center justify-center bg-black min-h-screen`}`\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eTwin's `tw` prop on jsx elements\u003c/b\u003e\n\u003c/summary\u003e\n\n❌\n```js\n\u003cdiv tw=\"flex bg-black\"\u003e...\u003c/div\u003e\n```\n\n✅     \n```js\nconst style = css`${tw`flex bg-black`}`\n\n\u003cdiv class={style}\u003e...\u003c/div\u003e\n```\n\u003c/details\u003e\n\n\n\n\n## Project setup\n\nClone the project\n```\ngit clone git@github.com:regenrek/vue-ts-twinmacro.git\n```\n\nInstall and run\n```\nyarn\nyarn serve\n```\n\n## Thanks to \nThis project is mostly inspired by the works of the following creators:\n\n[@wonderful-panda](https://github.com/wonderful-panda)\n[@antfu](https://github.com/antfu)\n[@ben-rogerson](https://github.com/ben-rogerson)\n[@luwanquan](https://github.com/luwanquan)\n[@egoist](https://github.com/egoist)\n[@u3u](https://github.com/u3u)\n\n### Customize configuration\nSee [Configuration Reference](https://cli.vuejs.org/config/).\n# vue-ts-twinmacro\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregenrek%2Fvue-ts-css-in-js-dark-mode-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fregenrek%2Fvue-ts-css-in-js-dark-mode-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fregenrek%2Fvue-ts-css-in-js-dark-mode-example/lists"}