Skip to content

Commit 5ee2b73

Browse files
authored
docs: align the front-office asset stack on AssetMapper and Tailwind CLI (#6)
1 parent 09e8bb7 commit 5ee2b73

6 files changed

Lines changed: 17 additions & 12 deletions

File tree

plugins/thelia/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "thelia",
33
"description": "Develop Thelia 3 with Claude Code: skills and agents for modules, Propel ORM, the API Platform bridge, the Flexy front-office, the default-twig back-office, and Thelia 2 to 3 migration.",
4-
"version": "0.4.0",
4+
"version": "0.5.0",
55
"author": {
66
"name": "Thelia"
77
},

plugins/thelia/skills/ddev/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ hooks:
110110
- composer: install
111111
- exec-host: ddev mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS db_test; GRANT ALL PRIVILEGES ON db_test.* TO 'db'@'%'; FLUSH PRIVILEGES;"
112112
- exec: php Thelia cache:clear
113-
- exec: bin/console sass:build
113+
- exec: php bin/console tailwind:build
114114
- exec: symfony run --daemon bin/console messenger:consume async -vv
115115
```
116116

plugins/thelia/skills/ddev/references/hooks-et-services.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ hooks:
3636
3737
### Hook: Compile assets
3838
39+
The two theme families do not share a toolchain: the Flexy front office runs on AssetMapper
40+
plus the Tailwind CLI binary and has no `package.json`, while the `default-twig` back office
41+
is still a Webpack Encore theme.
42+
3943
```yaml
4044
hooks:
4145
post-start:
42-
- exec: bin/console sass:build
43-
- exec: npm run build
46+
- exec: php bin/console importmap:install
47+
- exec: php bin/console tailwind:build
48+
- exec: bash -c "cd templates/backOffice/default-twig && npm install && npm run build"
4449
```
4550

4651
### Hook: Start Messenger

plugins/thelia/skills/fresh-install-test/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ddev exec composer install
7777

7878
# 5. Install Thelia with demo data and admin account
7979
ddev exec php bin/install \
80-
--frontoffice_theme=flexy --backoffice_theme=default \
80+
--frontoffice_theme=flexy --backoffice_theme=default-twig \
8181
--pdf_theme=default --email_theme=default \
8282
--with-demo --with-admin \
8383
--admin_login=thelia --admin_password=thelia \
@@ -163,7 +163,7 @@ ddev exec composer install
163163

164164
# 5. Install Thelia with demo data and admin account
165165
ddev exec php bin/install \
166-
--frontoffice_theme=flexy --backoffice_theme=default \
166+
--frontoffice_theme=flexy --backoffice_theme=default-twig \
167167
--pdf_theme=default --email_theme=default \
168168
--with-demo --with-admin \
169169
--admin_login=thelia --admin_password=thelia \

plugins/thelia/skills/thelia3/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "Thelia 3 e-commerce framework (Symfony 7.4 LTS, API Platform 4.3,
55

66
# Thelia 3 - Module Development Guide
77

8-
> Stack: Symfony 7.4 LTS, API Platform 4.3, PHP 8.3 or 8.4, Propel ORM. Front in Twig (Flexy, AssetMapper, Tailwind CLI), back-office in Twig via the default-twig theme. Email and PDF templates are Twig too. No Doctrine, no Messenger, no Turbo/Mercure.
8+
> Stack: Symfony 7.4 LTS, API Platform 4.3, PHP 8.3 or 8.4, Propel ORM. Front in Twig (Flexy, AssetMapper, Tailwind CLI), back-office in Twig via the default-twig theme. Email and PDF templates are Twig too. No Doctrine, no Messenger, no Mercure; Turbo ships with Flexy but Drive is off by default.
99
1010
## 0. Install and version constraints
1111

@@ -172,7 +172,7 @@ final class MyModule extends BaseModule
172172
- Twig: `resources('/api/front/...')`, `attr('product', 'id')`, `getForm(name)`, `hook(name)`, `theme_hook(name, params)`, `path(routeId)`.
173173
- Facades in LiveComponents: `CartFacade`, `CustomerFacade`, `OrderFacade`, `CheckoutFacade`.
174174
- Template overrides: place in `{module}/templates/frontOffice/flexy/`.
175-
- Assets: AssetMapper + Tailwind CLI, no Node build for the theme. Turbo/Mercure are ABSENT.
175+
- Assets: AssetMapper + Tailwind CLI, no Node build for the theme. Mercure is ABSENT; Turbo ships but Drive is opt-in per zone.
176176
- The theme carries the front catch-all route `/{_view}` (`FlexyBundle\Controller\ViewController`), which serves categories, products, contents and folders. No `thelia/front-module` is involved.
177177
- Details: [references/front-office.md](references/front-office.md)
178178

@@ -256,7 +256,7 @@ final class MyModule extends BaseModule
256256
| `SecurityContext::getSession()` in CLI | `requestStack->getMainRequest()->getSession()` null | push Request manually or use `IntegrationTestCase` |
257257
| `getComponent()` Stimulus without `await` | async hydration | always `await getComponent(this.element)` |
258258
| Stale `module_template_dirs.php` cache | not invalidated outside `module:post-activate-all` | `cache:clear` after activation |
259-
| Missing `templates-assets/{theme}/dist` symlink | first boot | ensure `THELIA_WEB_DIR/templates-assets/` is writable |
259+
| Missing `templates-assets/backOffice/{theme}/dist` symlink | first boot; back-office Encore themes only, the AssetMapper front never reads this path | ensure `THELIA_WEB_DIR/templates-assets/` is writable |
260260
| Propel `TINYINT` setter (`setVisible(true)`...) | column typed `?int`, `strict_types` rejects `bool` | pass `0`/`1` (DECIMAL = `?string`, never `float`) |
261261
| `trans('X')` PHP without domain gives unexpected French text | injected `TranslatorInterface` = **`core`** domain (Twig `\|trans` = `messages` domain); missing key returns raw string | specify module domain (`trans('X', [], 'mymodule')`) |
262262
| `Lang::getDefaultLanguage()` mistaken for current locale | = store default language (often `en_US`) | `$request->getLocale()` for the UI locale |
@@ -277,7 +277,7 @@ When working on a module, these patterns are more modern but not yet standard Th
277277
- DTO mapping: manual transformations -> `ObjectMapper` SF 7.3
278278
- Web security: Thelia `SecurityContext` + `checkAuth()` -> Symfony Voters + `#[IsGranted]` (Propel profile integration to design)
279279
- AP serialization perf: `JsonStreamer` SF 7.3 on large collections
280-
- Front interactivity: LiveComponents only -> Turbo Drive + Streams + Mercure (real-time)
280+
- Front interactivity: LiveComponents, plus Turbo Drive on the checkout only -> Drive site-wide + Streams + Mercure (real-time)
281281

282282
## 7. Essential vocabulary
283283

plugins/thelia/skills/thelia3/references/front-office.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ export default class extends Controller {
259259
}
260260
```
261261

262-
**Turbo and Mercure: ABSENT** from Flexy. Architectural choice - interactivity = LiveComponents only.
262+
**Mercure: ABSENT** from Flexy. Turbo ships - `@hotwired/turbo` sits in the theme's `importmap.php` and `assets/app.js` imports it - but the same file sets `Turbo.session.drive = false`, so Drive is off globally and only a zone marked `data-turbo="true"` (the checkout tunnel) navigates client-side. Everywhere else, interactivity = LiveComponents.
263263

264264
### Stimulus / front JS traps
265265

266266
- **`Intl` locale**: Thelia exposes locale as `fr_FR` (underscore) but `Intl.NumberFormat`/`Intl.DateTimeFormat` require `fr-FR` (`RangeError: Invalid language tag` otherwise). Always `(document.documentElement.lang || 'fr-FR').replace('_', '-')` before instantiating.
267267
- **`data-*-value` JSON**: for a Stimulus `Object`/`Array` value, always `{{ data|json_encode|e('html_attr') }}`. Without `e('html_attr')`, a quote in the JSON (e.g. a product title) silently breaks the HTML attribute (Stimulus parses a partial/empty value).
268268
- **URL template + route with regex constraint**: `path('route', {x: 'PLACEHOLDER'})` throws `InvalidParameterException` at **Twig render time** if the route declares a `requirement` on `x`. Pass a **valid** value as anchor (e.g. `'image'` for `image|document|virtual`) then substitute on the JS side on a slash-delimited segment (`url.replace('/image/', '/'+value+'/')`).
269-
- **Module front + Stimulus**: the theme loads its own `Application` via `@symfony/stimulus-bridge`. A module that starts a second `Application.start()` (`@hotwired/stimulus`) conflicts (double-loading of the same controller). Prefer vanilla JS, or register the controller in the theme's existing app.
269+
- **Module front + Stimulus**: the theme starts its own `Application` in `assets/stimulus_bootstrap.js` via `startStimulusApp()` from `@symfony/stimulus-bundle`. A module that starts a second `Application.start()` (`@hotwired/stimulus`) conflicts (double-loading of the same controller). Prefer vanilla JS, or register the controller in the theme's existing app.
270270

271271
## 8. Domain facades
272272

0 commit comments

Comments
 (0)