{"id":22903631,"url":"https://github.com/uniho/babel-plugin-stylis-css-in-js","last_synced_at":"2026-04-30T00:05:11.469Z","repository":{"id":117917249,"uuid":"383897420","full_name":"uniho/babel-plugin-stylis-css-in-js","owner":"uniho","description":"Minify CSS in tagged template literals with stylis!","archived":false,"fork":false,"pushed_at":"2021-07-12T09:08:09.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T20:51:55.851Z","etag":null,"topics":["babel","babel-plugin","css-in-js","javascript"],"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/uniho.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,"publiccode":null,"codemeta":null}},"created_at":"2021-07-07T18:54:22.000Z","updated_at":"2021-07-12T09:08:12.000Z","dependencies_parsed_at":"2023-07-26T00:16:18.258Z","dependency_job_id":null,"html_url":"https://github.com/uniho/babel-plugin-stylis-css-in-js","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"e2ffd55ce6e483c028bba7997d5264c44aa58e30"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/uniho/babel-plugin-stylis-css-in-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniho%2Fbabel-plugin-stylis-css-in-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniho%2Fbabel-plugin-stylis-css-in-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniho%2Fbabel-plugin-stylis-css-in-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniho%2Fbabel-plugin-stylis-css-in-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uniho","download_url":"https://codeload.github.com/uniho/babel-plugin-stylis-css-in-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniho%2Fbabel-plugin-stylis-css-in-js/sbom","scorecard":{"id":909931,"data":{"date":"2025-08-11","repo":{"name":"github.com/uniho/babel-plugin-stylis-css-in-js","commit":"e2ffd55ce6e483c028bba7997d5264c44aa58e30"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T18:44:53.807Z","repository_id":117917249,"created_at":"2025-08-24T18:44:53.807Z","updated_at":"2025-08-24T18:44:53.807Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","babel-plugin","css-in-js","javascript"],"created_at":"2024-12-14T02:38:04.486Z","updated_at":"2026-04-30T00:05:07.438Z","avatar_url":"https://github.com/uniho.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# babel-plugin-stylis-css-in-js\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![MIT][license-image]](LICENSE)\n\nMinify CSS in tagged template literals with [stylis](https://github.com/thysultan/stylis.js)!\n\n## Install\n\n```bash\nnpm install --save-dev babel-plugin-stylis-css-in-js\n```\n\n## Usage\n\n### Via config file, .babelrc, etc.\n```json\n{\n  \"plugins\": [\"stylis-css-in-js\"]\n}\n```\n\n### Via babel CLI\n```bash\nbabel --plugins=stylis-css-in-js  your.js\n```\n\n### Via Node API\n```js\nrequire('babel-core').transform(yourCode, {\n  plugins: ['stylis-css-in-js']\n});\n```\n\n## Example\n\nIf you have sources or sausages...\n\nindex.html:\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width\"\u003e\n    \u003ctitle\u003eTest\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"app\"\u003e\u003c/div\u003e\n  \u003c/body\u003e\n\n  \u003cscript crossorigin src=\"https://unpkg.com/react@17/umd/react.production.min.js\"\u003e\u003c/script\u003e\n  \u003cscript crossorigin src=\"https://unpkg.com/react-dom@17/umd/react-dom.production.min.js\"\u003e\u003c/script\u003e\n  \u003cscript crossorigin src=\"https://unpkg.com/stylis@4/dist/umd/stylis.js\"\u003e\u003c/script\u003e\n \n  \u003cscript src=\"index.js\"\u003e\u003c/script\u003e\n\u003c/html\u003e\n```\n\nindex.js:\n```js\n\n//\nwindow.css = String.raw;\n\n// like the emotion(https://emotion.sh/docs/@emotion/css#global-styles)\nconst injectGlobal = source =\u003e {\n  const bin = stylis.compile(source);\n  const plugins = [stylis.stringify];\n  const text = stylis.serialize(bin, stylis.middleware(plugins));\n  const nodes = document.querySelectorAll('style[data-stylis]');\n  let css = Array.prototype.find.call(nodes, node =\u003e node.getAttribute('data-stylis') === '0'); // \n  if (!css) {\n    const css = document.createElement('style');\n    css.setAttribute('type', 'text/css');\n    css.setAttribute('data-stylis', '0'); // \n    css.appendChild(document.createTextNode(text));\n    document.head.appendChild(css);\n    return;\n  }\n  const textNode = css.firstChild;\n  textNode.data += text + \"\\n\\n\";\n}\n\n//\nconst isTouchDevice = \n  ('ontouchstart' in window.document.documentElement) \n  || window.navigator.maxTouchPoints \u003e 0\n  || window.navigator.msMaxTouchPoints \u003e 0;\n\n//\nconst buttonBackgroundColor = \"rgb(100,100,100)\";\nconst buttonColor = \"white\";\nconst margin = '10rem';\n\n//\nconst myCSS = css`\n  /* your comment */\n  .my-page {\n    margin: ${margin}; // your comment\n\n    button {\n      cursor: pointer;\n      /*text-transform: uppercase;*/\n      /*margin-bottom: 10px;*/\n      background-image: none;\n      background-size: 0;\n      background-repeat: no-repeat;\n      background-position: 50% 50%;\n      padding: 10px 20px;\n      //display: inline-block;\n      font-family: Roboto;\n      border: 0;\n      border-radius: 2px;\n      box-shadow: 0 2px 5px 0 rgba(0,0,0,.14),0 2px 10px 0 rgba(0,0,0,.1);\n      background-color: ${buttonBackgroundColor};\n      color: ${buttonColor};\n      transition: background-color .3s ease-out;\n      will-change: background-color;\n\n      \u0026:hover {\n        ${isTouchDevice ? '' : css`\n          background-color: black;\n          color: red;\n        `}\n      }\n    \n      \u0026:active, \u0026:active:hover {\n        box-shadow: none;\n      }\n    }\n  }\n`;\n\n//\ninjectGlobal(myCSS);\n\n// \nconst MyApp = props =\u003e\n  React.createElement('div', {className: 'my-page'},\n    React.createElement('button', {}, 'Click Me')\n  );\n\n//\nReactDOM.render(React.createElement(MyApp), document.getElementById('app'));\n```\n\nLet's babel index.js...\n\n```js\n︙\n\nconst myCSS = css`.my-page{margin:${margin};}.my-page button{cursor:pointer;background-image:none;background-size:0;background-repeat:no-repeat;background-position:50% 50%;padding:10px 20px;font-family:Roboto;border:0;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.14),0 2px 10px 0 rgba(0,0,0,.1);background-color:${buttonBackgroundColor};color:${buttonColor};transition:background-color .3s ease-out;will-change:background-color;}.my-page button:hover{${isTouchDevice ? '' : css`background-color:black;color:red;`}}.my-page button:active,.my-page button:active:hover{box-shadow:none;}`;\n\n︙\n```\n\nAwosame🦈? Awesome!\n\n## Options\n\nIn `.babelrc`, etc. :\n\n```json\n{\n  \"plugins\": [\n    [\"stylis-css-in-js\", {\n      \"tags\": [\"css\", \"raw\"]\n    }]\n  ]\n}\n```\n\n| Option               | Default                  |Description                           |\n|----------------------|--------------------------|--------------------------------------|\n| `tags`               | `[\"css\"]`                | The name used for detecting css tag. |\n\n## Contribution  \n\n1. Fork it  \n2. Create your feature branch  \n3. Commit your changes  \n4. Push to the branch  \n5. Create new Pull Request\n\n## License\n\nMIT\n\n[npm-image]: https://img.shields.io/npm/v/babel-plugin-stylis-css-in-js.svg\n[npm-url]: https://npmjs.org/package/babel-plugin-stylis-css-in-js\n[downloads-image]: https://img.shields.io/npm/dm/babel-plugin-stylis-css-in-js.svg\n[downloads-url]: https://npmjs.org/package/babel-plugin-stylis-css-in-js\n[license-image]: https://badgen.net/badge/license/MIT/blue\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funiho%2Fbabel-plugin-stylis-css-in-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funiho%2Fbabel-plugin-stylis-css-in-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funiho%2Fbabel-plugin-stylis-css-in-js/lists"}