Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Nutshell: Enhanced Acorn Support for WordPress Themes

[![Code Style](https://github.com/yardinternet/skeleton-package/actions/workflows/format-php.yml/badge.svg?no-cache)](https://github.com/yardinternet/skeleton-package/actions/workflows/format-php.yml)
[![PHPStan](https://github.com/yardinternet/skeleton-package/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/skeleton-package/actions/workflows/phpstan.yml)
[![Code Style](https://github.com/yardinternet/nutshell/actions/workflows/format-php.yml/badge.svg)](https://github.com/yardinternet/nutshell/actions/workflows/format-php.yml)
[![PHPStan](https://github.com/yardinternet/nutshell/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/nutshell/actions/workflows/phpstan.yml)
![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/yard/nutshell/php)
![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/yard/nutshell/roots%2Facorn)

**Nutshell** is a feature-rich package designed to extend [Acorn](https://roots.io/acorn/) for WordPress themes. It provides a flexible foundation for advanced theme development, including configuration inheritance, Sentry integration, Vite asset support, and more.

Expand All @@ -10,21 +12,15 @@
- **Child Theme Configuration Inheritance**:
- Allows child themes to override parent configuration files without directory scans.
- Uses a custom configuration repository to support unsetting and merging config values.
- **Vite Asset Support**:
- Integrates with Vite for modern asset bundling and hot reloading.
- **Sentry Integration**:
- Seamless error reporting via Sentry for Laravel.
- Seamless error reporting via [`sentry/sentry-laravel`](https://github.com/getsentry/sentry-laravel)
- **CSP Integration**:
- Add CSP headers via [`spatie/laravel-csp`](https://github.com/spatie/laravel-csp)
- **Custom View Composers**:
- Manual registration of view composers for fine-grained control.
- **Custom Console Commands**:
- Register custom Artisan commands via configuration.

## Requirements

- PHP >= 8.1
- [Acorn](https://github.com/roots/acorn) ^4.3
- Composer

## Installation

1. Install this package with composer
Expand Down Expand Up @@ -78,12 +74,17 @@

2. **Update Acorn Bootloader**

- In your theme's `functions.php`, use the `Yard\Nutshell\bootloader()` helper to bootstrap Acorn with Nutshell's enhancements.
- In your theme's `functions.php`, use `Yard\Nutshell\Application` to build Acorn with Nutshell's enhancements.

```diff
-\Roots\bootloader()->boot();
+define('ACORN_BASEPATH', __DIR__);
+\Yard\Nutshell\bootloader()->boot();
add_action('after_setup_theme', function () {
- Application::configure()
+ Yar\Nutshell\Application::configure()
->withProviders([
App\Providers\ThemeServiceProvider::class,
])
->boot();
}, 0);
```
Comment on lines 79 to 88

3. **Update app config**
Expand Down Expand Up @@ -116,21 +117,16 @@
+ ],
```

6. **Vite Integration**
- Vite is enabled by default. Use the provided `Yard\Nutshell\Assets\Vite` class for asset management.

7. **Sentry Integration**
- Sentry is automatically integrated if `sentry/sentry-laravel` is installed and configured.
6. **Sentry Integration**
- Sentry is automatically integrated via `sentry/sentry-laravel`.

## Usage

- **Configuration Inheritance**: Any config file in your child theme's `config/` directory will override the parent. Empty config files will unset the corresponding configuration.
- **View Composers**: Register all composers manually in `config/view.php`.
- **Console Commands**: Register all commands manually in `config/console.php`.
- **Vite**: Use the `@vite` directive or helper as usual; Nutshell ensures correct asset paths.
- **Sentry**: Errors and exceptions are reported to Sentry automatically.

## About us

[![banner](https://raw.githubusercontent.com/yardinternet/.github/refs/heads/main/profile/assets/small-banner-github.svg)](https://www.yard.nl/werken-bij/)

17 changes: 7 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@
"config": {
"sort-packages": true,
"platform": {
"php": "8.1"
"php": "8.2"
}
},
"require": {
"php": ">=8.1",
"roots/acorn": "^4.3",
"php": ">=8.2",
"roots/acorn": "^5",
"sentry/sentry-laravel": "^4.4",
"spatie/laravel-csp": "^2.10",
"yard/logger": "^1.0"
Comment thread
ictbeheer marked this conversation as resolved.
},
"require-dev": {
"larastan/larastan": "^2.9",
"orchestra/testbench": "^8.31",
"szepeviktor/phpstan-wordpress": "^1.3",
"larastan/larastan": "^3.9",
"orchestra/testbench": "^10.11",
"szepeviktor/phpstan-wordpress": "^2.0",
"yard/php-cs-fixer-rules": "^1.0"
},
"autoload": {
"psr-4": {
"Yard\\Nutshell\\": "src/"
},
"files": [
"src/helpers.php"
]
}
},
"scripts": {
"post-autoload-dump": [
Expand Down
Loading