Remove Acorn as dependency; treat as requirement (#2827)

This commit is contained in:
Ben
2022-02-10 15:04:35 -08:00
committed by GitHub
parent 0bd1f42982
commit cd1e3af50f
3 changed files with 21 additions and 3 deletions

View File

@@ -61,6 +61,17 @@ Make sure all dependencies have been installed before moving on:
- [Node.js](http://nodejs.org/) >= 16
- [Yarn](https://yarnpkg.com/en/docs/install)
### Acorn
Although Sage makes use of Acorn, it doesn't ship with it included. This is to give you the flexibility to include it in a way that works best for your environment.
- **[Bedrock](https://github.com/roots/bedrock)** is the recommended way to manage your WordPress installation, themes, and plugins. If you're using Bedrock, you only need to require Acorn as a composer dependency in your Bedrock `composer.json`:
```sh
$ composer require roots/acorn
```
- If Bedrock isn't feasible, then the next best approach is to install Acorn as an **mu-plugin**. This guarantees that it will always be available and someone won't accidentally disable it and break your site. Add the Acorn directory to your `mu-plugins` directory, and make sure you have something to load it automatically, like our [`bedrock-autoloader`](https://github.com/roots/bedrock-autoloader).
- If neither of the preceding options is workable for you, then Acorn can always be installed as a **normal plugin** by putting the Acorn directory in your `plugins` folder. Just remember to activate it!
## Theme installation
**The `main` branch currently tracks Sage 10 which is in active development. Looking for Sage 9 or the latest Sage 10 beta release? [See releases](https://github.com/roots/sage/releases).**
@@ -78,6 +89,8 @@ To install the latest development version of Sage, add `dev-main` to the end of
$ composer create-project roots/sage your-theme-name dev-main
```
Make sure that you have Acorn installed. See the "Acorn" section above for instructions.
## Theme structure
```sh

View File

@@ -39,8 +39,7 @@
}
},
"require": {
"php": "^7.4|^8.0",
"roots/acorn": "v2.0.0-beta.9"
"php": "^7.4|^8.0"
},
"require-dev": {
"filp/whoops": "^2.12",

View File

@@ -29,7 +29,13 @@ require $composer;
|
*/
\Roots\bootloader();
try {
\Roots\bootloader();
} catch (Throwable $e) {
wp_die(
__('You need to install Acorn to use this theme.', 'sage')
);
}
/*
|--------------------------------------------------------------------------