Skip to content

Commit 93a3274

Browse files
thomlambclaude
andcommitted
Add CLAUDE.md with build commands and architecture overview
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ee55647 commit 93a3274

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

CLAUDE.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Package Manager
6+
7+
Use **pnpm** exclusively (workspace monorepo, pnpm v8.15.6+, Node 18+).
8+
9+
## Common Commands
10+
11+
All commands run from the repository root unless noted.
12+
13+
```bash
14+
# Linting & formatting
15+
pnpm stylelint # Check SCSS style violations
16+
pnpm stylelint:fix # Auto-fix SCSS violations
17+
pnpm prettier # Check code formatting (JS, JSON, CSS, SCSS)
18+
pnpm prettier:fix # Auto-format code
19+
20+
# Build a single theme (produces dist/ and theme.zip)
21+
pnpm build --theme=<theme-name> # Production build
22+
pnpm build:dev --theme=<theme-name> # Development build with source maps
23+
pnpm watch --theme=<theme-name> # Dev server on port 3000 (proxies Plone on 8080)
24+
25+
# Build all themes
26+
node build-all.js
27+
28+
# Create a new theme from the template
29+
pnpm create-theme <theme-name>
30+
```
31+
32+
## Architecture
33+
34+
### Monorepo Layout
35+
36+
```
37+
imio_smartweb_themes/
38+
├── [template]/ # Source template for new themes
39+
├── base/ # Shared base theme (published as @imiobe/plonetheme-smartweb-base)
40+
├── smartweb/ # Extended theme variant with fragments
41+
├── scripts/ # Theme creation helpers
42+
├── webpack.config.js # Webpack config (entry/output resolved via --theme flag)
43+
├── postcss.config.js # Autoprefixer only
44+
├── .stylelintrc.json # Stylelint config
45+
└── {municipality}/ # 155+ individual municipality themes
46+
```
47+
48+
### Theme Inheritance Chain
49+
50+
```
51+
@plone/plonetheme-barceloneta-base (Plone base)
52+
53+
base/ (SmartWeb shared theme)
54+
55+
{municipality}/ (Per-municipality overrides)
56+
```
57+
58+
Individual themes customise appearance solely through SCSS variable overrides; they rarely add new selectors.
59+
60+
### Per-Theme Structure
61+
62+
```
63+
{theme}/
64+
├── src/
65+
│ ├── index.js # Entry point: imports SCSS, jQuery nav/swiper handlers
66+
│ └── scss/
67+
│ ├── main.scss # @import variables first, then base/src/scss/main
68+
│ ├── variables.scss # Override !default SCSS vars from base
69+
│ └── home/ # Optional per-section homepage overrides
70+
├── dist/ # Built output (webpack)
71+
├── assets/fonts/images/svg/
72+
├── icons/logo.png # Source for auto-generated favicons
73+
├── manifest.cfg # Plone Diazo theme manifest
74+
├── rules.xml # Diazo XSLT transformation rules
75+
└── theme.zip # Packaged theme for Plone deployment
76+
```
77+
78+
### SCSS Variable System
79+
80+
`base/src/scss/variables.scss` defines 400+ variables with `!default`. Individual themes override them by declaring the variable **before** importing the base:
81+
82+
```scss
83+
// {theme}/src/scss/main.scss
84+
@import "./variables"; // theme overrides (no !default)
85+
@import "../../../base/src/scss/main"; // or @imiobe/... if installed via npm
86+
```
87+
88+
Key variable groups: `$primary`, `$grey-bg`, `$black-color`; typography sizes per heading level; layout container widths; component-specific vars for header, nav, swiper, sections, and homepage blocks.
89+
90+
### Base Theme SCSS Structure
91+
92+
```
93+
base/src/scss/
94+
├── variables.scss # All !default variables
95+
├── _mixin.scss # full-width, section-padding-top/bottom, fit-cover, etc.
96+
├── _general.scss
97+
├── _header.scss / _sitenav.scss / _sub-sitenav.scss
98+
├── common/ # _com-cookies, _com-faceted, _com-footer, _com-react, etc.
99+
├── sections/ # _se-textes, _se-contact, _se-gallery, _se-link, etc.
100+
└── homepage/ # _banner, _quick-access, _a-la-une, _actualites, _events, etc.
101+
```
102+
103+
### Build System
104+
105+
Webpack 5 resolves the theme path from the `--theme` env flag. Outputs:
106+
- `dist/css/theme.css` + `dist/js/theme.js`
107+
- Auto-generated favicons from `icons/logo.png`
108+
- `theme.zip` (FileManagerPlugin) for Plone deployment
109+
110+
Dev server writes assets to disk (required for Plone integrity hash) and proxies all non-bundle requests to `http://localhost:8080`.
111+
112+
### Plone Integration
113+
114+
Each theme ships a `manifest.cfg` (bundle paths) and `rules.xml` (Diazo XSLT rules that map Plone HTML regions into the `index.html` template). Theme prefix: `/++theme++{theme-name}`.
115+
116+
## Critical Files
117+
118+
- `webpack.config.js` — build config, understand before changing output paths
119+
- `base/src/scss/variables.scss` — all default variables; edits here affect every theme
120+
- `base/src/scss/main.scss` — import order for shared styles
121+
- `[template]/` — source of truth for new theme scaffolding
122+
- `scripts/create-theme.js` — theme creation automation (reads `.env` for INFRADOC_API_URL)
123+
124+
## Verification
125+
126+
After changes:
127+
1. Run `pnpm stylelint` and `pnpm prettier` — both should exit 0
128+
2. Run `pnpm build --theme=<any-theme>` — should produce `dist/` and `theme.zip`
129+
3. For base theme changes, test against at least one municipality theme build

0 commit comments

Comments
 (0)