|
| 1 | +### File replacements by Angular build configuration |
| 2 | + |
| 3 | +This note summarizes current file replacements defined in `angular.json` and the simplified approach using a centralized brand config. |
| 4 | + |
| 5 | +#### Current simplified replacements |
| 6 | + |
| 7 | +- **me** |
| 8 | + - `src/app/brand.config.ts` → `src/app/brand.config.me.ts` |
| 9 | +- **ma** (default) |
| 10 | + - `src/app/brand.config.ts` → `src/app/brand.config.ma.ts` |
| 11 | +- **dc** |
| 12 | + - `src/app/brand.config.ts` → `src/app/brand.config.dc.ts` |
| 13 | +- **me-production** |
| 14 | + - `src/environments/environment.ts` → `src/environments/environment.prod.ts` |
| 15 | + - `src/app/brand.config.ts` → `src/app/brand.config.me.ts` |
| 16 | +- **ma-production** |
| 17 | + - `src/environments/environment.ts` → `src/environments/environment.prod.ts` |
| 18 | + - `src/app/brand.config.ts` → `src/app/brand.config.ma.ts` |
| 19 | +- **dc-production** |
| 20 | + - `src/environments/environment.ts` → `src/environments/environment.prod.ts` |
| 21 | + - `src/app/brand.config.ts` → `src/app/brand.config.dc.ts` |
| 22 | + |
| 23 | +#### Using configuration flags |
| 24 | + |
| 25 | +Build commands select replacements via `--configuration`: |
| 26 | + |
| 27 | +- `ng serve --configuration=me` |
| 28 | +- `ng build --configuration=me` |
| 29 | +- `ng serve --configuration=dc` |
| 30 | +- `ng build --configuration=me-production` |
| 31 | +- `ng build --configuration=dc-production` |
| 32 | + |
| 33 | +#### Brand configuration files |
| 34 | + |
| 35 | +Each brand has its own config file that exports the same `BRAND_CONFIG` constant: |
| 36 | + |
| 37 | +**`src/app/brand.config.ts`** (default - MA) |
| 38 | + |
| 39 | +```typescript |
| 40 | +export const BRAND_CONFIG: BrandConfig = { |
| 41 | + logoPath: 'assets/images/mhc_logo.svg', |
| 42 | + faviconPath: 'assets/images/favicon.png', |
| 43 | + rosterTemplatePath: 'assets/roster_upload_template.xlsx', |
| 44 | + zipCodeDataPath: 'data/zipCode.json', |
| 45 | +}; |
| 46 | +``` |
| 47 | + |
| 48 | +**`src/app/brand.config.me.ts`** (Maine) |
| 49 | + |
| 50 | +```typescript |
| 51 | +export const BRAND_CONFIG: BrandConfig = { |
| 52 | + logoPath: 'assets/images/logo_me.svg', |
| 53 | + faviconPath: 'assets/images/favicon_me.png', |
| 54 | + rosterTemplatePath: 'assets/roster_upload_template_me.xlsx', |
| 55 | + zipCodeDataPath: 'data/zipCodeME.json', |
| 56 | +}; |
| 57 | +``` |
| 58 | + |
| 59 | +**`src/app/brand.config.dc.ts`** (District of Columbia) |
| 60 | + |
| 61 | +```typescript |
| 62 | +export const BRAND_CONFIG: BrandConfig = { |
| 63 | + logoPath: 'assets/images/mhc_logo.svg', // Keep default for now |
| 64 | + faviconPath: 'assets/images/favicon.png', // Keep default for now |
| 65 | + rosterTemplatePath: 'assets/roster_upload_template.xlsx', // Keep default for now |
| 66 | + zipCodeDataPath: 'data/zipCode.json', // Keep default for now |
| 67 | +}; |
| 68 | +``` |
| 69 | + |
| 70 | +#### Implementation |
| 71 | + |
| 72 | +Components now reference `BRAND_CONFIG` instead of hardcoded paths: |
| 73 | + |
| 74 | +- `HeaderComponent` uses `BRAND_CONFIG.logoPath` |
| 75 | +- `EmployerDetailsComponent` exposes `brand = BRAND_CONFIG` |
| 76 | +- Template binds roster template link to `brand.rosterTemplatePath` |
| 77 | + |
| 78 | +#### Benefits of this approach |
| 79 | + |
| 80 | +- **Single file replacement**: Only swap `brand.config.ts` per brand |
| 81 | +- **No code changes needed**: Components automatically use the correct paths |
| 82 | +- **Easy maintenance**: Update paths in one place per brand |
| 83 | +- **Production builds**: Combine brand config + environment swap |
| 84 | +- **Future expansion**: Add new brand-specific assets by updating config files |
| 85 | + |
| 86 | +#### Example npm scripts |
| 87 | + |
| 88 | +```json |
| 89 | +{ |
| 90 | + "scripts": { |
| 91 | + "start:me": "ng serve --configuration=me", |
| 92 | + "build:me": "ng build --configuration=me", |
| 93 | + "build:me:prod": "ng build --configuration=me-production", |
| 94 | + "start:dc": "ng serve --configuration=dc", |
| 95 | + "build:dc:prod": "ng build --configuration=dc-production" |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +#### Next steps |
| 101 | + |
| 102 | +1. Add brand-specific assets (logos, favicons, templates, zip code data) |
| 103 | +2. Update brand config files with correct paths |
| 104 | +3. Test builds with `--configuration` flags |
| 105 | +4. Consider adding brand-specific SCSS variables for theming |
0 commit comments