Inicio - Documentación - POM AI - 19 MCP - POM Theme setting tools - `pom_theme_generate_assets`: regenerate theme assets

pom_theme_generate_assets: regenerate theme assets

Rebuilds POM Theme's generated CSS — and its JavaScript, if the full generator is available.

Arguments

Argument Required Meaning
dry_run No Report which generator would run, without running it

Permissions

Allow POM Theme writes open, plus manage_options. It is classed as a write even though it creates nothing new — it replaces files the site serves.

Two generators, and you get whichever exists

If the theme's full asset generator is available, it runs and rebuilds CSS and JavaScript. If not, the tool falls back to a CSS-only rebuild.

The dry run reports which one would run, and pom_theme_get_status reports both up front under assets_helpers.

That distinction matters when JavaScript is the problem: on a site where only the CSS-only path exists, this tool will never fix a stale script, and no amount of re-running it will.

Dry-run the asset generation and tell me which generator this site has.

You usually do not need to call it

The CSS write tools regenerate assets automatically. After pom_theme_update_global_css, pom_theme_upsert_custom_css or pom_theme_delete_custom_css, the rebuild has already happened and the response includes the resulting file metadata.

Calling this afterwards is harmless and redundant.

When it is the right tool

  • The generated stylesheet is missing. Common after a migration: the database came across, the generated files did not.
  • A settings change did not appear. Colours, typography, buttons and header styling are compiled into the stylesheet; a change made outside these tools may not have triggered a rebuild.
  • A partial build. The stylesheet exists but is suspiciously small.
  • After enabling a theme feature whose CSS is only compiled when the feature is in use.

In each case, check pom_theme_get_generated_css before and after, and compare filemtime and size.

It overwrites the live stylesheet

The site serves the result immediately. If the build fails partway, visitors get a broken or truncated stylesheet, and there is no previous version to fall back to.

That is a small risk on a healthy site and a real one where the uploads directory is nearly full or permissions are marginal. On a busy production site, prefer a quiet moment.

It rebuilds from current settings

The output reflects the theme settings as they are now. If someone has been editing settings in the admin without saving, or if a setting is in an unexpected state, this bakes that state into the stylesheet.

It is not a repair tool. It cannot recover CSS that was overwritten, and it does not validate anything — invalid custom CSS is compiled in exactly as stored.

Then purge the cache

A rebuilt file is not a visible change. The page cache, the CDN and browsers all need clearing.

Regenerate the theme assets, then clear the site cache.

See Clearing the cache after a change and pom_cache_clear_site_cache.

If it does not help

The rebuild produced a current file and the site still looks wrong. That is now a caching problem or a CSS problem, not a build problem — and re-running this tool will not change either.

Check the asset version string, then the source CSS.

After running

  1. Read the generated CSS and confirm filemtime moved and size is plausible.
  2. Purge the cache and CDN.
  3. Load several page types, including one with a feature-specific style.

Common problems

Symptom Cause
The write is refused POM Theme write gate closed
pom_ai_mcp_forbidden Missing manage_options
The file is still missing The uploads directory is not writable
JavaScript is still stale This site only has the CSS-only generator
filemtime did not move The generator did not run
No visible change Cache, CDN, or the asset version
The site still looks wrong Not a build problem; check the source CSS

Related