{"id":13393525,"url":"https://github.com/johanholmerin/style9","last_synced_at":"2025-04-09T03:14:21.170Z","repository":{"id":38420581,"uuid":"237447448","full_name":"johanholmerin/style9","owner":"johanholmerin","description":"CSS-in-JS compiler inspired by Meta's stylex","archived":false,"fork":false,"pushed_at":"2023-12-05T22:39:06.000Z","size":1171,"stargazers_count":569,"open_issues_count":3,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T14:14:59.021Z","etag":null,"topics":["babel-plugin","compiled-css-in-js","css","css-in-js","typescript","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/johanholmerin.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-01-31T14:33:17.000Z","updated_at":"2025-03-14T16:36:06.000Z","dependencies_parsed_at":"2023-12-05T23:41:04.550Z","dependency_job_id":null,"html_url":"https://github.com/johanholmerin/style9","commit_stats":{"total_commits":257,"total_committers":12,"mean_commits":"21.416666666666668","dds":0.1089494163424124,"last_synced_commit":"fb108c0a075b7ccc6cf3e77beb546f38eff266de"},"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanholmerin%2Fstyle9","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanholmerin%2Fstyle9/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanholmerin%2Fstyle9/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johanholmerin%2Fstyle9/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johanholmerin","download_url":"https://codeload.github.com/johanholmerin/style9/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247968375,"owners_count":21025823,"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":["babel-plugin","compiled-css-in-js","css","css-in-js","typescript","webpack"],"created_at":"2024-07-30T17:00:55.132Z","updated_at":"2025-04-09T03:14:21.147Z","avatar_url":"https://github.com/johanholmerin.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Libraries"],"sub_categories":[],"readme":"# style9\n\nCSS-in-JS compiler inspired by Meta's [StyleX][stylex], with near-zero runtime, atomic CSS extraction and TypeScript support. Framework agnostic.\n\n\u003e [!NOTE]\n\u003e [StyleX][stylex] was open-sourced on 2023-12-5. Consider using that instead\n\n## Basic usage\n\n*For a complete walkthrough of the API, see [Usage guide](docs/Usage-guide.md).*\n\n```javascript\nimport style9 from 'style9';\n\nconst styles = style9.create({\n  blue: {\n    color: 'blue',\n  },\n  red: {\n    color: 'red'\n  }\n});\n\ndocument.body.className = styles('blue', isRed \u0026\u0026 'red');\n```\n\nFor the above input, the compiler will generate the following output:\n\n```javascript\n/* JavaScript */\ndocument.body.className = isRed ? 'cRCRUH ' : 'hxxstI ';\n\n/* CSS */\n.hxxstI { color: blue }\n.cRCRUH { color: red }\n```\n\n## Installation\n\n```sh\n# Yarn\nyarn add style9\n\n# npm\nnpm install style9\n```\n\n## Compiler setup - required\n\nThe following is the minimally required Webpack setup for extracting styles to a CSS file. For Webpack options and Rollup, Next.js, Gatsby,Vite, and Babel plugins, see [Bundler plugins](docs/Bundler-plugins.md).\n\n```javascript\nconst Style9Plugin = require('style9/webpack');\nconst MiniCssExtractPlugin = require('mini-css-extract-plugin');\n\nmodule.exports = {\n  // Collect all styles in a single file - required\n  optimization: {\n    splitChunks: {\n      cacheGroups: {\n        styles: {\n          name: 'styles',\n          type: 'css/mini-extract',\n          // For webpack@4 remove type and uncomment the line below\n          // test: /\\.css$/,\n          chunks: 'all',\n          enforce: true,\n        }\n      }\n    }\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.(tsx|ts|js|mjs|jsx)$/,\n        use: Style9Plugin.loader,\n      },\n      {\n        test: /\\.css$/i,\n        use: [MiniCssExtractPlugin.loader, 'css-loader']\n      }\n    ]\n  },\n  plugins: [\n    new Style9Plugin(),\n    new MiniCssExtractPlugin()\n  ]\n};\n```\n\n## Documentation\n\n1. [Background](docs/Background.md)\n1. [Usage guide](docs/Usage-guide.md)\n1. [Bundler plugins](docs/Bundler-plugins.md)\n1. [TypeScript](docs/TypeScript.md)\n1. [Ecosystem](docs/Ecosystem.md)\n1. [How it works](docs/How-it-works.md)\n1. [FAQ](docs/FAQ.md)\n1. [Example apps](examples)\n\n## Have a question?\n\nLook at the [FAQ](docs/FAQ.md), [search][search] the repo, or ask in [discussions][discussions].\n\n[stylex]: https://github.com/facebook/stylex\n[search]: https://github.com/johanholmerin/style9/search\n[discussions]: https://github.com/johanholmerin/style9/discussions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanholmerin%2Fstyle9","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohanholmerin%2Fstyle9","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohanholmerin%2Fstyle9/lists"}