The decision to remove Acorn from composer requirements in Sage 10

I’m not fully understanding the reason why Acorn was removed from Sage 10’s composer requirements. The GitHub Readme includes some information but the following is tripping me up:

If you’re using Bedrock, you only need to require Acorn as a composer dependency in your Bedrock composer.json

I can already install it as a composer dependency without Bedrock tho, why do I need Bedrock?

This is primarily where the confusion comes from. It makes me curious if there’s a plan to cripple it (Acorn) in the future without Bedrock and that worries me a little. I do see it says you can install as an mu-plugin, but then it goes on to suggest using bedrock-autoloader…why would I need an autoloader with an mu-plugin, that’s the whole point of an mu-plugin, no?

I’m also looking at the new package requirements, @roots/bud-eslint, @roots/bud-tailwind, etc. Why do all these packages need to be wrapped as bud extensions? I think as recently as beta 2 you could still manage your own versions of these packages.

When all is said and done, I guess I’m having anxiety that Sage is leaving behind its roots (pun intended?) as a non-judgemental starter theme to some self-contained ecosystem where Bedrock and Bud and whatever else comes folded in and is unremovable, where Bud has complete control over my packages, and Sage itself becomes just another overly opinionated and monolithic codebase. :cold_sweat:

I’m sure I’m overreacting but it’s Sunday and it’s easier to over react on Discourse than clean the garage.

1 Like

Howdy! You’re early - these changes are part of the next Sage beta we’re announcing tomorrow :slight_smile:

Yes, you can install it as a Composer dependency within the theme. We’re recommending that you don’t, because themes shouldn’t be responsible for handling your dependencies. You don’t need Bedrock.

It’s literally the opposite. Acorn is more flexible now.

To automatically load the mu-plugin if you aren’t using something to load it manually. We’d love to make the instructions easier to understand.

They don’t need to be. Do you really want to maintain all those dependencies yourself, or do you want Bud to do it? It’s up to you. We’re defaulting to not doing that.

Remember, Sage is a starter theme. Fork it and modify it for your needs. That’s the entire point of it.

This is the leanest, least opinionated version of Sage to date. We’re really happy with how it’s looking right now.

4 Likes

You can re-add Acorn to Sage in your non-Bedrock project if you want.

# wp-content/themes/sage
composer require roots/acorn

I know you didn’t mention it, but if there’s also anxiety over the config directory being removed, that’s also just as easy to restore.

wp acorn acorn:init

You can restore all of the config files with another command:

wp acorn vendor:publish --tag=acorn

As @ben said, Acorn is more flexible than ever and restoring the previous structure and behavior can be done in a matter of seconds.

5 Likes

I’m riding that bleeding edge! Mainly it’s just that I ran into an issue with Beta 2 that required merging in some recent commits, so when I started another new project on Friday I went straight to the latest commit. Enabled the theme, got the Acorn is missing error, and down the rabbit hole I went.

That was my biggest concern here, so I’m glad to hear that.

I’ve run into version specific issues with packages before, so yeah, I prefer having control over that. My other concern here stemmed from the fact that there was practically nothing there the last time I looked at Bud’s documentation. I looked again a moment ago and there’s been some major updates, the documentation is dramatically better now. That’s going to be a big help in making the transition less painful.

Sage has always been a great starter theme and I was just worried that it was moving too far away from what I had grown accustomed to. Something something old dogs, new tricks :man_shrugging: I realize 10 is still in beta and I need to temper my opinions around that fact.

Thanks for the response and for all the work you and the roots team have done on this.

1 Like

Hello. I come from a sage 9.x project, and having pulled recently the 10.x “main” branch, I’ve come to the problem “You need to install Acorn to use this theme.”. I’m using Wordpress 6.0.1.

I’ve tried @QWp6t 's instructions to reinstall acorn inside my theme, but the message persists.

I’ve also installed acorn on the WP root directory, but it doesn’t seem to work, as my project is not a Bedrock project.

At this point I’m desperate: I cannot access to my WP admin dashboard, it’ll always show the error message. I’ve searched for hours for a solution in this forum and the documentation pages, but anything seems to work. Any help would be appreciated. Thanks in advance!

Did you try installing Acorn as a plugin? Acorn 2.x: Installation | Roots Documentation
Also, if you rename the sage theme temporarily (for example to mytheme.bak) you should be able to access you dashboard again.
Note: if you install Acorn as a plugin you must activate it before you activate the Sage theme.

I tried to put the plugin in the mu-plugins folder, but I have no idea how to load it before the theme. I checked those instructions yo are linking, and the bedrock-autoloader repo, but it’s unclear to me how to put it all together to work…

Maybe try to install Acorn as a normal plugin, so you can manually enable it.

Renaming the theme folder to *.bak didn’t work, the error message kept showing.
I finally managed to install the acorn plugin as a regular plugin, and activate it with the WP CLI, but with a couple of workarounds that I’ll describe for future reference:

I had to install composer dependencies inside the acorn plugin folder (this wasn’t specified in any instructions I consulted). To achieve this, I also had to comment out the “require-dev” section in composer.json, as some of those dev dependencies need PHP 8.x, and I’m working with 7.4

I appreciate the hard work behind Sage, it’s a great piece of software, but I find the documentation pretty brief and laking of necessary details to make the process of installing/upgrading/getting-things-done less painful, in my humble opinion.

Thanks for your help!

This shouldn’t be necessary. The instructions for installing acorn link to the releases: Acorn 2.x: Installation | Roots Documentation The latest release probably isn’t what you want if you’re on PHP 7.x, but 2.1.2 should probably work: Release v2.1.2 · roots/acorn · GitHub The packaged releases (i.e. the ZIP files there) contain all Acorn dependencies.

If there’s something you feel the instructions are missing, we encourage contributions to the docs, which are open source!

I installed acorn 2.x, and had to execute “composer install” inside the acorn plugin folder with the “require-devs” commented out in order to make it work, otherwise:

 ✘  ~/Downloads/acorn-2.x  composer install --no-dev
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - pestphp/pest-plugin-mock[dev-master, v1.0.0, ..., v1.0.3] require php ^8.0 -> your php version (7.4.22) does not satisfy that requirement.
    - pestphp/pest-plugin-mock 1.x-dev is an alias of pestphp/pest-plugin-mock dev-master and thus requires it to be installed too.
    - Root composer.json requires pestphp/pest-plugin-mock ^1.0 -> satisfiable by pestphp/pest-plugin-mock[v1.0.0, ..., 1.x-dev (alias of dev-master)].

Oh, and another thing I had to do which i forgot to mention: to install the acorns plugin with the WP CLI:

 wp plugin activate acorn-2.x

I also had to comment out temporarily this section in “functions.php”:

try {
    \Roots\bootloader();
} catch (Throwable $e) {
    wp_die(
        __('You need to install Acorn to use this theme.', 'sage'),
        '',
        [
            'link_url' => 'https://docs.roots.io/acorn/2.x/installation/',
            'link_text' => __('Acorn Docs: Installation', 'sage'),
        ]
    );
}

otherwise the same message arised ‘You need to install Acorn to use this theme.’, even in the command line.

I understand this is open source, and I thank for it. But I still don’t have the necessary knowledge of how all the pieces work together to dare making a pull request on the docs. I just encounter one obstacle after another following the docs, and wanted to share my frustration for what it’s worth. For the time being, I’ll try to post the solutions that worked for me in this forum, in case it helps anyone else.