Global Styles
The styles command group syncs the Global Styles of a Full-Site Editing (FSE) WordPress theme. It reads and writes the JSON payload that drives theme.json and any extra CSS added via the Site Editor.
How it works
Section titled âHow it worksâWordPress stores Global Styles as a custom post. The CLI fetches that post (including its ID) on pull and writes it back on push. Because the ID is embedded in the saved JSON file, you must always pull before push on a fresh checkout.
Commands
Section titled âCommandsâlps styles pull
Section titled âlps styles pullâDownload the current Global Styles from WordPress and save them to a JSON file.
lps styles pull [path]| Argument | Default | Description |
|---|---|---|
path | ./styles.json | Output file (includes the style ID required for push) |
Example:
lps styles pulllps styles pull ./theme/styles.jsonlps styles push
Section titled âlps styles pushâUpload Global Styles back to WordPress. The command also bundles any *.css files found in ./styles/**/*.css and injects them as the custom CSS property.
lps styles push [path]| Argument | Default | Description |
|---|---|---|
path | ./styles.json | JSON file previously created by pull |
| Flag | Description |
|---|---|
--dryRun / -d | Show the payload that would be sent without making changes |
Example:
# Edit styles.json, then:lps styles push
# With extra CSS files:# ./styles/typography.css and ./styles/components.css are bundled automaticallyRecommended directory layout
Section titled âRecommended directory layoutâstyles.json â pulled from WordPress (commit this)styles/ typography.css components.css overrides.cssThe JSON file is committed to Git. CSS files are bundled on the fly during push so you can split your custom CSS across multiple files without touching styles.json manually.
- The
pathargument must point to a JSON file that contains anidfield. If the file is missing anid, the push will fail with an error. - Global Styles are theme-specific. Switching themes resets them; always re-pull after a theme change.