agentleFS
educlopezeduclopez/mallard/skills/ps-theme-cache/SKILL.md

ps-theme-cache

Skill4 starsChanged 13 days agoMITView on GitHub

Makes a PrestaShop CSS/JS change actually reach the browser when the theme combines assets into themes/<theme>/assets/cache/theme-*.css and bottom-*.js (CCC, Panda child themes). Use when a custom.css or theme JS edit is saved but the page still looks unstyled, when the stylesheet loaded is assets/cache/theme-<hash><n>.css, or right after deploying a theme change to PRE/PROD ("el CSS no se actualiza", "no se ve el cambio", "borra la caché del tema", "PS_CCCCSS_VERSION", "limpiar caché CSS tras el deploy").

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No borres a mano los ficheros de assets/cache/: es salida generada y se regenera sola.

    line 57

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PS theme cache — que el CSS/JS nuevo se sirva

Cuándo ocurre

El tema no sirve assets/css/custom.css directamente: lo agrupa en themes/<theme>/assets/cache/theme-<hash><version>.css (y bottom-*.js). Si cambias custom.css o un .tpl con clases nuevas, el HTML ya sale con el markup nuevo pero el CSS agrupado es el viejo. Síntoma típico: el elemento aparece sin estilo (por ejemplo, un badge como texto plano).

Confirmar en el navegador:

[...document.styleSheets].map(s => s.href).filter(h => h && /assets\/cache/.test(h))

El nombre acaba en la versión (theme-ff491a1214.css → versión 1214). Si el estilo nuevo no está en getComputedStyle, es esto.

Local (Lando)

La versión vive en {prefix}configuration, name = 'PS_CCCCSS_VERSION', una fila por tienda (id_shop NULL + cada tienda). Subirla genera un fichero nuevo:

cat > q.sql <<'EOF'
UPDATE {prefix}configuration SET value = value + 1 WHERE name = 'PS_CCCCSS_VERSION';
EOF
lando ssh -s database -c "mysql -uroot <recipe> -e 'source /app/q.sql'"; rm q.sql
lando php bin/console cache:clear

Recarga la página (con una pausa: si el JS corre antes de que cargue, querySelector devuelve null).

Antes de lanzar el SQL: el prefijo sale de database_prefix en app/config/parameters.php (en ps9-espaciopiessanos es sp9_, no ps_) y la BD de Lando es lemp con la receta lemp (usuario root). Si la cache:clear se queda sin memoria, añade -d memory_limit=-1 al php y usa --no-warmup. Si el CSS sigue siendo el viejo, comprueba que el nombre del fichero cacheado cambió de versión antes de buscar otra causa.

PRE / PROD

Después de un pull que toque assets/css/ o templates/ con clases nuevas, hay que regenerar la caché:

  1. Preferido: Backoffice → Parámetros avanzados → Rendimiento → Borrar caché. En multitienda, hazlo en todas las tiendas (cada una tiene su versión).
  2. Alternativa por servidor: subir PS_CCCCSS_VERSION de esa tienda en +1 (y PS_CCCJS_VERSION si cambió JS). Si la tienda corre en entorno dev (modo depuración), limpia también la caché dev: bin/console cache:clear --env=dev --no-warmup. Es una escritura en la DB del servidor: pedir confirmación antes, sobre todo en PROD.

No borres a mano los ficheros de assets/cache/: es salida generada y se regenera sola.

Verificar

Abrir la ficha en el navegador, esperar ~3 s y comprobar que el href del CSS cambió de versión y que el estilo nuevo se aplica (getComputedStyle(el).backgroundColor, etc.).

Gotchas

  • themes/<theme>/assets/cache/ suele aparecer como no trackeado en git status: no lo commitees.
  • La herramienta JS del navegador puede bloquear páginas cuyo URL lleve query string (?controller=product&id_product=…): usa la URL amigable del producto.
  • Si el cambio es solo .tpl sin CSS nuevo, basta bin/console cache:clear (Smarty); no hace falta tocar CCC.
  • Esto no sustituye al pipeline de ps-css-build (ese es para proyectos con _dev/css); aquí el CSS se edita a mano en custom.css y solo falta invalidar la caché.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.