diff --git a/CLAUDE.md b/CLAUDE.md index f0d0832..b8f2358 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -102,6 +102,9 @@ Do NOT modify web-base files — they are shared across all projects. 8. Tailwind CSS as primary styling, custom CSS scoped with BEM when needed 9. Twig concatenation uses `~` operator: `'value=' ~ variable` 10. `enlace` (link) fields already include slashes +11. **File hooks (`hooks/*.php`) do NOT inject variables.** Always read params manually: `$params = json_decode(file_get_contents('php://input'), true) ?: [];` — Only module hooks (`modulos/*/hook.php`) receive variables directly. +12. **`tipo` is a reserved variable.** The `.htaccess` injects `tipo=barra` on every request. Never use `tipo` as a hook parameter name — it gets overwritten, causing 404s. Use `account_type`, `user_tipo`, etc. +13. **Never pass `html` via `save_module` to modules with configured builder vars** (banners, carousels, modules with images/colors set from admin). It corrupts the visual configuration. Only pass `js` and/or `css`. See [docs/deploy-and-sync.md](docs/deploy-and-sync.md). ## Documentation @@ -114,3 +117,4 @@ Do NOT modify web-base files — they are shared across all projects. - [docs/production-patterns.md](docs/production-patterns.md) — Real production patterns (header, zigzag, FAQ, forms) - [docs/vue-builder-rules.md](docs/vue-builder-rules.md) — CMS-VUE rules (tabs, colorpicker, components) - [docs/vue-builder-examples.md](docs/vue-builder-examples.md) — Vue builder examples (Banner Slideshow, etc.) +- [docs/deploy-and-sync.md](docs/deploy-and-sync.md) — Deploy to production (save_module, sync, minified regeneration) diff --git a/docs/css-js-conventions.md b/docs/css-js-conventions.md index 8460082..ca477f4 100644 --- a/docs/css-js-conventions.md +++ b/docs/css-js-conventions.md @@ -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 `