{"id":21195610,"url":"https://github.com/openpeeps/bro","last_synced_at":"2025-07-10T04:30:27.896Z","repository":{"id":170711026,"uuid":"485844314","full_name":"openpeeps/bro","owner":"openpeeps","description":"Bro - A super fast stylesheet language for cool kids! Alternative to SassC, DartSass SassJS and Less.","archived":false,"fork":false,"pushed_at":"2024-03-04T09:36:11.000Z","size":919,"stargazers_count":18,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-03-05T09:57:52.803Z","etag":null,"topics":["bro","bro-lang","cascading-style-sheets","css","css-compiler","csstree","dart-sass","developer-tools","development-tools","front-end-development","frontend","hacktoberfest","javascript","nim","nim-lang","nodejs","sass","scss","stylesheet-language","webdevelopment"],"latest_commit_sha":null,"homepage":"https://openpeeps.github.io/bro/theindex.html","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openpeeps.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":"2022-04-26T15:28:05.000Z","updated_at":"2024-02-29T08:56:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c876d0b-3abc-413b-ad73-c7cf888b5b71","html_url":"https://github.com/openpeeps/bro","commit_stats":null,"previous_names":["openpeeps/bro"],"tags_count":0,"template":false,"template_full_name":"openpeeps/pistachio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpeeps%2Fbro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpeeps%2Fbro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpeeps%2Fbro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openpeeps%2Fbro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openpeeps","download_url":"https://codeload.github.com/openpeeps/bro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225618241,"owners_count":17497485,"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":["bro","bro-lang","cascading-style-sheets","css","css-compiler","csstree","dart-sass","developer-tools","development-tools","front-end-development","frontend","hacktoberfest","javascript","nim","nim-lang","nodejs","sass","scss","stylesheet-language","webdevelopment"],"created_at":"2024-11-20T19:29:07.285Z","updated_at":"2024-11-20T19:29:08.294Z","avatar_url":"https://github.com/openpeeps.png","language":"Nim","funding_links":["https://www.paypal.com/donate/?hosted_button_id=RJK3ZTDWPL55C"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/openpeeps/bro/blob/main/.github/bro.png\" alt=\"Bro aka NimSass\" width=\"170px\"\u003e\u003cbr\u003e\n  😋 Bro ⚡ A super fast stylesheet language for cool kids!\u003cbr\u003e👑 Written in Nim language\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://openpeeps.github.io/bro/theindex.html\"\u003eAPI reference\u003c/a\u003e | \u003ca href=\"#\"\u003eDownload\u003c/a\u003e (not yet)\u003cbr\u003e\n  \u003cimg src=\"https://github.com/openpeeps/bro/workflows/test/badge.svg\" alt=\"Github Actions\"\u003e  \u003cimg src=\"https://github.com/openpeeps/bro/workflows/docs/badge.svg\" alt=\"Github Actions\"\u003e\n  \u003cbr\u003e\u003cbr\u003e\u003cimg src=\"https://github.com/openpeeps/bro/blob/main/.github/bro-cli.png\" width=\"779px\"\u003e\n\u003c/p\u003e\n\n## 😍 Key Features\n- ⚡ Extremely fast \u0026 Highly optimized [Jump to Benchmarks](#benchmarks)\n- 🍃 Lightweight, **1.5MB** tiny executable\n- 🐱 Dependency Free / **No Virtual Machine**\n- 💪 **Strongly Typed** = Perfect **Cascading Style Sheets** 🤩\n- 🌍 Works on **Linux**, **macOS**, **Windows**\n- 🔖 A beautiful, improved `SASS`-like Syntax [Learn Bro in 5 minutes](https://github.com/openpeeps/bro/wiki/Learn-Bro-in-5-minutes)\n- 📚 Standard Library (`strings`, `arrays`, `objects`, `math`, `regex`, `os`) [Check the manual](https://github.com/openpeeps/bro/wiki/Standard-Library)\n- 👋 Human readable Syntax =\u003e **Developer friendly**\n  - `var` \u0026 `const`\n  - `[]` Arrays\n  - `{}` Objects\n  - `if` \u0026 `case` Conditionals  \n  - `for` Loop Statements\n  - `fn` Functions \u0026 `mix` Mixins\n    - Overloading + Closures + Forward declaration\n  - `CSS` to `BASS` AST with `include some.css`\n  - `BASS` imports using `import std/[strings, math]`\n  - **JSON/YAML stream** to BASS using `json(\"some.json\")`, `yaml(\"some.yml\")`\n- 👏 Built-in CSS Optimization (Autoprefixer, Minifier, CSS Alphabetize \u0026 Deduplication)\n- 🗺 **CSS SourceMap Generator**\n- 🔄 **CSS Reload** \u0026 **Browser sync** [Setup info](https://github.com/openpeeps/bro/wiki/Index#css-reload--browser-syncing)\n- 🌴 **Abstract Syntax Tree** binary serialization\n- 🎉 Built-in `HTML`, `JSON` Documentation Generator\n- 🔥 Works with **Node.js** \u0026 **Bun.js** via `NAPI`\n- 🎆 Works in **Browser via WASM** (unstable)\n- 🌍 Dynamically Linked Library\n- 👉 `Warnings` =\u003e Unused **Variables**\n- 👉 `Warnings` =\u003e Unused **Mixins**, **Functions**, **Empty selectors**\n- 👉 `Errors` =\u003e **invalid** properties/values or typos!\n- 🏳 Recommended Extension `.bass`\n- 🎩 Open Source | [LGPLv3 license](https://github.com/openpeeps/bro/blob/main/LICENSE)\n- 👑 Written in **Nim language**\n- 😋 **Made for Cool Kids**\n\n\u003e [!WARNING]  \n\u003e Bro is still under development. Expect bugs and incomplete features.\n\n\n\u003e [!NOTE]\n\u003e Since Bro is written in native code, anti-virus software can sometimes incorrectly flag it as a virus\n\n## Bro CLI\nInstall Bro as a standalone CLI application. Get it from [Releases](#) or build it from source using Nim \u0026 Nimble.\n\n\n### Bro 💛 Nim\nIntegrate Bro in your Nim application\n\n```nim\nimport bro\n\nlet stylesheet = \"\"\"\n$colors = [blue, yellow, orchid]\nfor $color in $colors:\n  .bg-{$color}\n    background: $color \n\"\"\"\n\nvar\n  p: Parser = parseStylesheet(stylesheet)\n  c: Compiler = newCompiler(p.getStylesheet, minify = true)\necho c.getCSS # .bg-blue{background:blue}.bg-yellow{...\n```\n\n### Bro 💖 Bun \u0026 Node.js\nIntegrate the most powerful CSS pre-processor in your Node.js/Bun app. Bro is available as a native addon module\n\n```javascript\nlet stylesheet = `\n$colors = [blue, yellow, orchid]\nfor $color in $colors:\n  .bg-{$color}\n    background: $color\n`\nconst bro = require(\"bro.node\")\nbro.compile(stylesheet) // .bg-blue{background:blue}.bg-yellow{...\n```\n\n### Bro in Browser via Wasm\nBuild complex real-time web-apps using Bro + WebAssembly\n```html\n\u003cstyle type=\"text/bro\" id=\"stylesheet\"\u003e\n$colors = [blue, yellow, orchid]\nfor $color in $colors:\n  .bg-{$color}\n    background: $color\n\u003c/style\u003e\n\u003cscript src=\"/bro.min.js\"\u003e\u003c/script\u003e\n```\n\n```js\nbro.compile('#stylesheet') // .bg-blue{background:blue}.bg-yellow{...\n```\n\n## Benchmarks\nDartSass, SassC, **Bro**, **BroJS (via NAPI w/ Node \u0026 Bun)**, Sass (JS w/ Node \u0026 Bun)\n\n1.572.876 lines of \n```sass\n.btn\n  background: yellow\n```\n\n```\nBenchmark 1: ./dart sass.snapshot test.sass:test.css --no-source-map --style=compressed\n  Time (abs ≡):         4.925 s               [User: 6.060 s, System: 0.263 s]\n \nBenchmark 2: bro test.sass test.css --min\n  Time (abs ≡):        441.7 ms               [User: 422.3 ms, System: 19.9 ms]\n \nBenchmark 3: sassc test.sass test.css --style=compressed\n  Time (abs ≡):         5.757 s               [User: 5.346 s, System: 0.400 s]\n \nBenchmark 4: bun bro.js\n  Time (abs ≡):        679.0 ms               [User: 616.0 ms, System: 24.0 ms]\n \nBenchmark 5: node bro.js\n  Time (abs ≡):        653.7 ms               [User: 625.8 ms, System: 32.3 ms]\n \nBenchmark 6: node sass.js\n  Time (abs ≡):        12.783 s               [User: 19.640 s, System: 1.185 s]\n \nBenchmark 7: bun sass.js\n  Time (abs ≡):        10.485 s               [User: 20.422 s, System: 1.030 s]\n \nSummary\n  'bro test.sass test.css --min' ran\n    1.48 times faster than 'node bro.js'\n    1.54 times faster than 'bun bro.js'\n   11.15 times faster than './dart sass.snapshot test.sass:test.css --no-source-map --style=compressed'\n   13.03 times faster than 'sassc test.sass test.css --style=compressed'\n   23.74 times faster than 'bun sass.js'\n   28.94 times faster than 'node sass.js'\n```\n\n[Check Benchmarks page](https://github.com/openpeeps/bro/wiki/Benchmarks) for more numbers\n\n\u003c/details\u003e\nBenchmarks made with [hyperfine](https://github.com/sharkdp/hyperfine) on\u003cbr\u003e\n**Ubuntu 22.04 LTS** / Ryzen 5 5600g 3.9GHz × 12 / RAM 32 GB 3200MHz / SSD M.2\n\n\n## TODO\n- [x] The Interpreter (Tokens, Lexer, Parser, AST, Compiler)\n- [x] CSS Selectors [ref](https://www.w3.org/TR/selectors-3/#selectors)\n  - [ ] Type Selectors [ref](https://www.w3.org/TR/selectors-3/#type-selectors)\n  - [ ] Universal Selectors [ref](https://www.w3.org/TR/selectors-3/#universal-selector)\n  - [ ] Attribute Selectors [ref](https://www.w3.org/TR/selectors-3/#attribute-selectors)\n  - [x] Class Selectors [ref](https://www.w3.org/TR/selectors-3/#class-html)\n  - [x] ID Selectors [ref](https://www.w3.org/TR/selectors-3/#id-selectors)\n  - [ ] Pseudo-classes [ref](https://www.w3.org/TR/selectors-3/#pseudo-classes)\n  - [ ] Pseudo-elements [ref](https://www.w3.org/TR/selectors-3/#pseudo-elements)\n  - [ ] Groups of Selectors [ref](https://www.w3.org/TR/selectors-3/#grouping)\n  - [ ] Combinators [ref](https://www.w3.org/TR/selectors-3/#combinators)\n- [x] Compile-time\n  - [x] Variables\n  - [x] Arrays/Objects\n    - [x] Anonymous arrays and objects\n  - [x] Constants\n  - [x] Functions\n    - [x] Closures\n    - [x] Overloading\n    - [ ] Recursive calls\n  - [ ] Mixins\n  - [x] Conditionals (`if`, `elif`, `else`, and `case`)\n  - [x] For/Loop statements `for $x in $y`\n  - [ ] Typed CSS properties/values\n  - [x] Warnings unused `variables`, `functions`\n  - [ ] CSS Variable Declaration using `var` instead of `--`\n  - [ ] String/Variable concatenation using `\u0026` and backticks\n- [ ] Handle single/multi line comments\n- [x] Memoization\n- [x] Import CSS/BASS files\n  - [ ] Implement AST caching system\n- [x] Command Line Interface \n  - [x] CLI `watch` for live changes\n  - [x] CLI `build` BASS code to CSS\n  - [ ] CLI generate source `map`\n  - [x] CLI `ast` command for generating binary AST\n- [x] Build\n  - [x] Cross-platform compilation\n  - [x] Node.js/Bun.js via NAPI \n  - [ ] Browser with WASM via Emscripten\n\n#### 0.2.x\n- [ ] Convert boring SASS to BASS\n- [ ] CLI `doc` command for generating documentation website\n\n\n### ❤ Contributions \u0026 Support\n- 🐛 Found a bug? [Create a new Issue](https://github.com/openpeeps/bro/issues)\n- 👋 Wanna help? [Fork it!](https://github.com/openpeeps/bro/fork)\n- Create a Syntax Highlighter for your favorite code editor. \n- 😎 [Get €20 in cloud credits from Hetzner](https://hetzner.cloud/?ref=Hm0mYGM9NxZ4)\n- 🥰 [Donate to OpenPeeps via PayPal address](https://www.paypal.com/donate/?hosted_button_id=RJK3ZTDWPL55C)\n\n### 🎩 License\nBro Language [LGPLv3 license](https://github.com/openpeeps/bro/blob/main/LICENSE).[Made by Humans from OpenPeeps](https://github.com/openpeeps).\u003cbr\u003e\nCopyright \u0026copy; 2024 OpenPeeps \u0026 Contributors \u0026mdash; All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenpeeps%2Fbro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenpeeps%2Fbro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenpeeps%2Fbro/lists"}