Repository navigation
Add bin/dev for previewing the theme in a browser - #15
Merged
Merged
Conversation
Serves the test/fixtures site through bridgetown start with a standard esbuild + Tailwind v4 frontend, so asset_path resolves to real bundles and edits to layouts/ and frontend/styles/ live-reload. Also fixes the README Tailwind snippet, which placed @source between the two @import rules and caused the theme import to be silently dropped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bin/dev, modeled on the Jekyll guidedrails script:bundle installif needed,npm installif needed, thenexec bundle exec bridgetown startwith any extra args passed through (e.g.bin/dev -P 4001).bin/devserves thetest/fixturessite. The fixture now carries a standard Bridgetown esbuild + Tailwind v4 frontend (esbuild.config.js,config/esbuild.defaults.jsgenerated bybridgetown esbuild setup,postcss.config.jswith@tailwindcss/postcss, and afrontend/styles/index.cssthat mirrors the README recipe but imports the partial from the working tree). That's what makesasset_path :css/:jsin the layout resolve to real hashed bundles instead ofMISSING_FRONTEND_BUNDLING_CONFIG.config/initializers.rbnowrequire_relatives the gem (the CLI path doesn't go throughtest/helper.rb), adds the gem'slayouts/toadditional_watch_paths, and setsfast_refresh = falsebecause fast refresh assumes changed paths live undersrc/and errors on the absolute layout path.pumato the Gemfile's development group; without itbridgetown startreports "Unable to find a Rack server."bin/from the gem'sfilesglob and gitignores the fixture'soutput/andtmp/.Background
Bridgetown 2.x's
startcommand doesn't launch the frontend bundler itself. It loads the site's Rakefile and invokesfrontend:watcher, which shells out to the site'sfrontend:devtask, hence the minimaltest/fixtures/Rakefile. The official Tailwind automation runs the Tailwind CLI as a sidecar and patches the manifest by hand, but since the layout usesasset_path :css(manifest keystyles/index.css), running Tailwind through esbuild's PostCSS pipeline is simpler and matches what a host site following the README actually does.README fix
While wiring the fixture, the theme partial's rules never showed up in the built CSS. Cause: the README snippet placed
@sourcebetween@import "tailwindcss"and@import "bridgetown-stoa". CSS requires all@importrules to be consecutive and precede other rules, so both@tailwindcss/postcssandpostcss-importsilently dropped the second import (postcss-import emits a warning; Tailwind doesn't). Any host site that followed the README as written got no theme styles. The snippet is reordered and the reason noted. CHANGELOG has an entry under Unreleased.Test plan
bin/dev -P 4599boots Puma, esbuild buildsindex.<hash>.jsandindex.<hash>.css, and the rendered page links both via/_bridgetown/static/.--color-stoa-*tokens and thehtml { background: var(--color-stoa-bg) ... }base rule.layouts/bridgetown-stoa/layout.serbtriggers a clean full rebuild (was aNoMethodErrorunder fast refresh before disabling it).frontend/styles/bridgetown-stoa.cssmakes esbuild rebuild, the manifest change triggers a Bridgetown reload.script/cibuildpasses (rubocop clean, 4 tests / 20 assertions). The test suite never touches npm.Notes
test/fixtures/package-lock.jsonis excluded by the maintainer's global gitignore, sobin/devkeys its reinstall check offpackage.jsonmtime rather than the lockfile. Force-add the lockfile if reproducible npm installs become important.package-lock.json(a leftover from the self-referencing dep bug fixed in Match bridgetown-quick-search plugin conventions #12) was deleted locally; it was untracked.🤖 Generated with Claude Code