feat(branding): add @brand vite alias + migrate in-app img consumers
vite-branding.ts is the shared resolver. Exports BRAND_DIR (absolute, defaults to ./branding/default) and brandAlias for spreading into each vite config's resolve.alias map. All 9 vite configs now spread brandAlias so `@brand/<file>` resolves to the active brand dir at build time. Migrates the four <img src="@/assets/logo.png"> consumers (Login.vue, LoginDemo.vue, AppSidebar.vue, MobileDrawer.vue) to @brand/logo.png. Unused Navbar.old.vue left as-is. Build verified: dist/assets/logo-<hash>.png emits from the aliased import. Future deployers point BRAND_DIR at their brand kit and the in-app logo follows automatically. Part of aiolabs/webapp#95. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
50a345ce4e
commit
eebb566323
14 changed files with 41 additions and 4 deletions
19
vite-branding.ts
Normal file
19
vite-branding.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { resolve } from 'node:path'
|
||||
|
||||
/**
|
||||
* Absolute path to the active brand kit. Deployers point this at their
|
||||
* own `branding/<name>/` directory (see branding/README.md).
|
||||
*
|
||||
* Defaults to the committed aiolabs default brand. Used by vite configs
|
||||
* for the `@brand` import alias and by pwa-assets.config.ts.
|
||||
*/
|
||||
export const BRAND_DIR = resolve(process.env.BRAND_DIR ?? './branding/default')
|
||||
|
||||
/**
|
||||
* Spread into a vite config's `resolve.alias` map. Lets components
|
||||
* import deployer-provided assets via `@brand/<file>` instead of
|
||||
* hardcoding `@/assets/logo.png`.
|
||||
*/
|
||||
export const brandAlias = {
|
||||
'@brand': BRAND_DIR,
|
||||
} as const
|
||||
Loading…
Add table
Add a link
Reference in a new issue