{"id":18920955,"url":"https://github.com/gnat/stylus-inline","last_synced_at":"2026-01-07T06:46:10.611Z","repository":{"id":207477896,"uuid":"689214169","full_name":"gnat/stylus-inline","owner":"gnat","description":"Zero build step version of Stylus CSS that runs in your browser. With inlined scopes! Written in vanilla JS. Also single file python version!","archived":false,"fork":false,"pushed_at":"2024-09-26T11:35:13.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T20:37:25.314Z","etag":null,"topics":["compiler","css","indentation-parsing","inline-css","inline-styles","offside-rule","stylus","stylus-css","sugarss","transpiler","whitespace","whitespace-language"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/gnat.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":"2023-09-09T05:37:31.000Z","updated_at":"2024-09-26T11:35:17.000Z","dependencies_parsed_at":"2023-11-16T02:28:16.890Z","dependency_job_id":"8726ce6a-3a3f-430c-bdca-d2340258a1cf","html_url":"https://github.com/gnat/stylus-inline","commit_stats":null,"previous_names":["gnat/stylus-inline"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Fstylus-inline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Fstylus-inline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Fstylus-inline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnat%2Fstylus-inline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnat","download_url":"https://codeload.github.com/gnat/stylus-inline/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249061026,"owners_count":21206439,"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":["compiler","css","indentation-parsing","inline-css","inline-styles","offside-rule","stylus","stylus-css","sugarss","transpiler","whitespace","whitespace-language"],"created_at":"2024-11-08T10:44:53.359Z","updated_at":"2026-01-07T06:46:10.583Z","avatar_url":"https://github.com/gnat.png","language":"HTML","readme":"# 🪄 Stylus CSS Inline (SugarSS Inline)\n\nExperiment based on [css-scope-inline](https://github.com/gnat/css-scope-inline). Made to work like [Stylus](https://github.com/stylus/stylus) CSS originally concieved by [\nTJ Holowaychuk](https://github.com/tj) of Express.js (or like [sugarss](https://github.com/postcss/sugarss))\n\nWith new [CSS Nesting](https://developer.chrome.com/articles/css-nesting/), `hsl()` syntax differences and true CSS variables: **classic Stylus is beginning to diverge too greatly with vanilla CSS. It's time to leave!** -- This project may be an option for you.\n\n## 🐍 Python Version (stylus.py)\n* Most reliable version since it generates `main.styl` for you to load normally.\n* This version is a bit more complete and robust than the Javascript one.\n\n## ☕ Javascript Version (stylus.html)\n* Runs in the browser automatically!\n* Works inside inline scoped `\u003cstyl\u003e`!\n* Syntax highlighting in Sublime works!\n* Including external `.styl`\n  * Implementation pitfalls:\n    * Browser removes invalid CSS from `\u003clink\u003e` and `@import()` making those paths invalid for processing.\n    * We use the workaround below...\n\n**main.styl**\n```html\ndocument.currentScript.outerHTML = `\n\u003cstyl\u003e\nhtml\n\tbackground: green\n\u003c/styl\u003e`\n```\n**index.html**\n```html\n\u003cscript src=\"main.styl\"\u003e\u003c/script\u003e\n```\n**BONUS: Ability to include `.styl` within `.styl`**\n* 🟠 Warning: May cause undesirable loading times as parent `.styl` must load *first*!\n  * You're probably best off avoiding `.styl` within other `.styl` for loading performance.\n```html\ndocument.currentScript.outerHTML = `\n\u003cstyl\u003e\nhtml\n\tbackground: green\n\u003c/styl\u003e\n\u003cstyl src=\"component.styl\"\u003e\u003c/styl\u003e\n`; document.querySelectorAll('styl[src]').forEach(s =\u003e { let ns = document.createElement('script'); ns.src = s.getAttribute('src'); s.replaceWith(ns) })\n```\n\n\n## 👀 Before you adopt.\n\nI realise Stylus is amazing but.. you lose the ability to inline styles in a single line (tailwind-like). Sure, you save `{` and `}` but you gain verbosity elsewhere (unless of course you **always** add a new line for each style anyway!) May not be worthwhile to use this code depending on what patterns you currently enjoy using.\n\n**A good highlighter can help a lot.**\n\n![image](https://github.com/user-attachments/assets/0fb41d75-6df2-46e5-9496-251eb84fd0b7)\n\n\n![image](https://github.com/user-attachments/assets/f659fc31-e473-449a-8377-f3539a07fb0c)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnat%2Fstylus-inline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnat%2Fstylus-inline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnat%2Fstylus-inline/lists"}