Add production rules discovered during real projects
- Correct hooks-and-api.md: file hooks vs module hooks param injection, FK naming not always _num, CmsApi.hook Promise pattern - Add 9 new rules to hooks-and-api.md: reserved `tipo` var, ghost modules, cms_uploads schema, name vs title by menuType, menuOrder, localCache gotcha, slug generation, uploads from hooks, CocoEmail - Add 5 rules to modular-system.md: minified/ dir, Docker workflow, debug tools (?compiletwig/?pruebas), general sections deploy, controlador - Add 2 rules to css-js-conventions.md: Vue inline conflict, Vue mount delay - Add testing section to quick-reference.md - Create docs/deploy-and-sync.md for production deploy and sync rules - Promote 3 critical rules to CLAUDE.md (rules 11-13) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,9 +83,17 @@ if (section) {
|
||||
### CmsApi (Client-Side)
|
||||
|
||||
```js
|
||||
// Callback
|
||||
CmsApi.hook('/hooks/module_id/', { action: 'getData', id: 123 }, function(response) {
|
||||
console.log(response);
|
||||
});
|
||||
|
||||
// Promise
|
||||
CmsApi.hook('/hooks/module_id/', { action: 'getData', id: 123 }).then(function(res) {
|
||||
console.log(res);
|
||||
}).catch(function(err) {
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
### Cuándo usar Vue 3
|
||||
@@ -123,6 +131,8 @@ createApp({
|
||||
|
||||
Siempre usar `'${'` y `'}'` como delimitadores Vue para evitar conflicto con Twig.
|
||||
|
||||
**IMPORTANTE: JS Vue SIEMPRE en `script.js`, nunca inline.** Twig también interpreta `${ }`. Si el JS con Vue está inline en `<script>` dentro de `index-base.tpl`, Twig lo corrompe al renderizar. Todo el código Vue debe ir en el archivo `script.js` del módulo.
|
||||
|
||||
---
|
||||
|
||||
## Variables Globales Disponibles
|
||||
@@ -216,6 +226,12 @@ Después de cambios dinámicos: `AOS.refresh()` en JavaScript.
|
||||
|
||||
---
|
||||
|
||||
## Testing con Vue
|
||||
|
||||
Vue necesita 3-5 segundos para montar después de navegar a una página. El `display:none` inicial se quita cuando `checkAuth()` o el `mounted()` completan. Al testear con Playwright, esperar antes de verificar contenido Vue.
|
||||
|
||||
---
|
||||
|
||||
## Buenas prácticas
|
||||
|
||||
- HTML/Twig semántico
|
||||
|
||||
Reference in New Issue
Block a user