Repository navigation
feat(shared-utils): detect project layout instead of hardcoding web/app/themes and sage - #150
Closed
YvetteNikolov wants to merge 2 commits into
Closed
YvetteNikolov wants to merge 2 commits into
YvetteNikolov wants to merge 2 commits into
Conversation
A single dev server means laravel-vite-plugin writes one hot file, into the public directory of the theme hosting it. Standalone parent themes had no public/hot of their own and ended up hardcoding the path to sage's. The plugin copies the hot file into every theme's public directory on server start and removes the copies on shutdown. A hard kill leaves them behind, so the toolkit gains a clean command that removes leftovers.
…pp/themes and sage The toolkit assumed themes live in web/app/themes and the parent theme is named sage. Both are now resolved: the themes directory from config, env, composer installer-paths or a probe of known layouts; the parent/child relation from each theme's style.css header; the asset base URL from where the themes directory sits relative to the docroot. The resolver is authored as CommonJS with an ESM facade so the CJS configs can share it without a build step. The toolkit gains an info command that prints what was resolved.
YvetteNikolov
requested review from
FreakyWizard,
JasperS20,
WybeBosch,
Yannicvanveen,
laravdiemen and
rivanuff
and removed request for
a team
October 8, 2026 13:58
This was referenced Oct 8, 2026
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.
Split from #144. Stacked on #149 (shares
brave.jsand the root vitest config); rebase ontomainafter that one merges.De toolkit ging er altijd vanuit dat thema's in
web/app/themesstaan en dat het parent themesageheet. Beide worden nu automatisch bepaald, zodat de tools ook buiten onze eigen Brave-projecten werken en meerdere parent themes naast elkaar kunnen draaien.shared-utils
resolve-theme-context.cjs: themes directory fromyard-toolkit.config.json/package.json#yardToolkit,YARD_THEMES_DIR,composer.jsoninstaller-paths, or a probe of known layouts (web/app/themesfirst, so existing projects resolve as before).style.cssTemplate:header; default theme picked from config → only parent →sage→ first parent (with a warning)./app/themesfor Bedrock,/wp-content/themesfor classic).tryResolveThemeContext(non-throwing), per-cwd cache,clearThemeContextCachefor tests.exports, no build step. Tests with fixtures for every layout.Consumers
themeForPath; newyard-toolkit infoprints the resolved layout.themesBaseUrl, blade watch glob from the themes dir, block output dir viathemeForPath,@sagealias falls back to the default theme.Follow-ups move eslint-config, prettier-config and postcss-config onto the resolver.