Running `wp acorn optimize` breaks CSS

Hello again. Learning a lot with this stack, but I’ve another issue. When I run the build-after hook from Trellis, which basically runs:

- name: Run Acorn optimize
  command: wp acorn optimize
  args:
    chdir: "{{ deploy_helper.new_release_path }}"

it breaks the stylesheet on my staging instance. Changing this to:

- name: Run Acorn optimize
  command: wp acorn optimize:clear
  args:
    chdir: "{{ deploy_helper.new_release_path }}"

Makes it work again. Just adding this to see if a) I’m doing something wrong which is then requiring this addition and b) if someone else has the same issue.

Are you running the latest Acorn?

What about your stylesheet is breaking?

Yes, I believe so, everything is a fresh install.

The break - whilst the stylesheet is there (and this is just on a base install of sage 10, with no additions or customisations) there is no css at all applied to the ‘welcome to wordpress’ screen.

I’ve restarted the whole process again on a new droplet, and tested at each instance - adding the deploy-after hook broke the css after a deploy; adding in :clear and deploying again brought it back up.

Have you looked at dev console? Is the stylesheet URL wrong? Is the CSS not generated at all? Anything in the network tab?

OK I’ve ‘rebroken’ the site to investigate. It seems that the site is trying to find:

url/wp/app/themes/ceupress/public/css/app.8c2f5f.css

rather than

url/app/themes/ceupress/public/css/app.8c2f5f.css

For a similar reason, it’s breaking the JS too.

When I add back in the ‘clear’ statement, all works and directs fine

You might be hitting this bug:

1 Like

Thanks, that was the one, and the solution presented works. Unsure why this issue has presented itself; on the other site I’m building alongside this one, the issue didn’t arise, despite very similar setups.