Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ test/dest

/.ruby-lsp/
/Gemfile.lock
test/fixtures/output
test/fixtures/tmp
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- ...
### Added
- `bin/dev` serves the `test/fixtures` site with the theme applied for browser previews. The fixture now carries a standard Bridgetown esbuild + Tailwind v4 (`@tailwindcss/postcss`) frontend, so `asset_path :css` / `:js` resolve to real bundles, and it watches the gem's `layouts/` directory so theme edits live-reload.

### Fixed
- README's Tailwind setup snippet placed `@source` between the two `@import` rules, which made Tailwind and postcss-import silently drop `@import "bridgetown-stoa"`. The imports now come first.

## [0.3.0] - 2026-05-22

Expand Down
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ gemspec

gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"]

group :development do
gem "puma" # Rack server for bin/dev
end

group :test do
gem "minitest"
gem "minitest-profile"
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ Then in `frontend/styles/index.css`, after `@import "tailwindcss";`, add two lin

```css
@import "tailwindcss";
@source "../../node_modules/bridgetown-stoa/layouts/**/*.serb";
@import "bridgetown-stoa";
@source "../../node_modules/bridgetown-stoa/layouts/**/*.serb";
```

- `@import "bridgetown-stoa"` pulls in the `@theme` tokens (`--color-stoa-*`, `--font-stoa-*`) and a small `@layer base` that styles `html` with the theme colors. Keep it directly after the Tailwind import: CSS requires all `@import` rules to come before any other rule, and an `@import` placed after `@source` is silently dropped.
- `@source` tells Tailwind to scan Stoa's layouts for utility-class usage.
- `@import "bridgetown-stoa"` pulls in the `@theme` tokens (`--color-stoa-*`, `--font-stoa-*`) and a small `@layer base` that styles `html` with the theme colors.

Override any token by redeclaring it in your own `@theme` block after the import.

Expand Down Expand Up @@ -77,8 +77,11 @@ Requires Ruby ≥ 3.2 and Bridgetown ≥ 2.0.
```shell
bundle install
script/cibuild # rubocop + minitest
bin/dev # preview the theme at http://localhost:4000
```

`bin/dev` serves the site in `test/fixtures` with the theme applied, using a standard Bridgetown esbuild + Tailwind pipeline (it runs `bundle install` and `npm install` for you when needed). Edits to `layouts/` and `frontend/styles/` rebuild and live-reload. Extra arguments go to `bridgetown start`, e.g. `bin/dev -P 4001`.

Templates use [Serbea](https://www.bridgetownrb.com/docs/template-engines/erb-and-beyond), Bridgetown's ERB-with-Liquid-like-sugar engine. Stoa is **inspired by** just-the-docs, not a port of it — layouts are written idiomatically for Bridgetown rather than translated from upstream.

## License
Expand Down
19 changes: 19 additions & 0 deletions bin/dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Serve the test fixture site with the theme applied, for previewing changes
# to layouts and styles in a browser. Extra arguments are passed through to
# `bridgetown start` (e.g. `bin/dev -P 4001`).
set -euo pipefail

cd "$(dirname "$0")/.."

if ! bundle check >/dev/null 2>&1; then
bundle install
fi

cd test/fixtures

if [ ! -f node_modules/.package-lock.json ] || [ package.json -nt node_modules/.package-lock.json ]; then
npm install
fi

exec bundle exec bridgetown start "$@"
2 changes: 1 addition & 1 deletion bridgetown-stoa.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/Guided-Rails/bridgetown-stoa"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|bin|spec|features|frontend)/!) }
spec.test_files = spec.files.grep(%r!^test/!)
spec.require_paths = ["lib"]
spec.metadata = {
Expand Down
21 changes: 21 additions & 0 deletions test/fixtures/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

# Minimal Bridgetown site Rakefile: gives `bridgetown start` (via bin/dev)
# a `frontend:dev` task so it can run esbuild alongside the site watcher.

require "bridgetown"

Bridgetown.load_tasks

namespace :frontend do
desc "Build the frontend with esbuild for deployment"
task :build do
sh "npm run esbuild"
end

desc "Watch the frontend with esbuild during development"
task :dev do
sh "npm run esbuild-dev"
rescue Interrupt
end
end
Loading
Loading