Acorn Setup on a Bedrock Install

Hey there, new user. I am trying to install Acorn on a fresh Bedrock project and I have a few questions.

  1. I’d like to install Acorn from the root directory of my Bedrock install. The idea is to be able to use Acorn throughout my plugins and all themes. I have run into a ton of problems trying this and eventually opted to install in the theme directory. This isn’t optimal but gave better results - did I give up too easily? Is it possible? What is the standard approach to this?

  2. Read a post stating that Bedrock will be changing it’s directory structure. This would be changing the location of the Config directory, which I assume would help greatly with the mentioned folder clash when installing in Bedrock. Is this something I should be waiting for before trying to proceed?

  3. I’ve gotten as far as running some migrations and starting to setup Sessions. When attempting to make and put, I expected some errors (intentional) but got the message:
    **Fatal error**: Uncaught ReflectionException: Class "app.debug" does not exist

I found these errors quite often when trying to install on the Bedrock root - Class "config" does not exist, Class "<classname here>" does not exist.

I am at this point assuming I am making some very silly mistake I can’t seem to figure out. Is it extremely opinionated on directory structure? Is there detailed documentation to get Acorn up and running?

I’ve found the Acorn documentation good for the install, but not very informative in terms of getting it up and running flawlessly - setting up sessions, ensuring debug works etc etc.

Perhaps I’m just a dummy. But could really use some help as I like what I see but can’t exactly get her running.

FYI: I am using Bedrock with Acorn instead of Sage because I don’t use Tailwind and prefer Vite over Bud.

Acorn needs to be booted in after_setup_theme either way so whether it’s functions.php or an mu-plugin, it shouldn’t matter much.

If you’re insistent on booting it in a plugin, I’d use Acorn v5 (which will get another beta release today) and the new boot process in the PR opened for docs: Acorn v5 installation and upgrading docs by retlehs · Pull Request #527 · roots/docs · GitHub

As far as Bud goes, Sage 11 in the main branch is switching to Vite and already has Acorn v5 setup. Radicle is soon to follow which out of the box, outside of Tailwind, has more of the directory structure it seems you’re aiming for.

Thank you for the quick reply. So I’m assuming most of my issues stem from directory structure (re: class does not exist)?

If just installing Bedrock + Acorn, Acorn should be installed in the Bedrock directory, the app or the theme itself? (Or plugin, should I go that route)

Will likely go ahead and purchase Radical once the updates occur anyhow, but would love to see what I can get going on Bedrock + Acorn for the time being. Just need to use Acorn v5 and follow the instructions for the new boot process correct?

I would install it in a theme so it can use the default configured base path. Otherwise, with Acorn v5 you can pass a custom base path to Application::configure(basePath: '...') and create the expected directories such as resources, app, etc. You will also need to make sure you have PSR-4 handled in your composer config.

I heavily recommend just using Sage 11 or checking out Radicle which both include configurations we actively support. Using Bedrock as-is for the base path of Acorn won’t work out of the box due to conflicts in structure which is more or less why Radicle exists to piece it all together.

1 Like