Repository: roots/sage
Branch: main
Commit: 55ef65d093b7
Files: 49
Total size: 30.3 KB
Directory structure:
gitextract_mlgy7jua/
├── .editorconfig
├── .gitattributes
├── .github/
│ ├── labeler.yml
│ ├── renovate.json
│ └── workflows/
│ ├── discourse.yml
│ ├── labeler.yml
│ └── main.yml
├── .gitignore
├── LICENSE.md
├── README.md
├── app/
│ ├── Providers/
│ │ └── ThemeServiceProvider.php
│ ├── View/
│ │ └── Composers/
│ │ ├── App.php
│ │ ├── Comments.php
│ │ └── Post.php
│ ├── filters.php
│ └── setup.php
├── composer.json
├── functions.php
├── index.php
├── package.json
├── public/
│ └── .gitkeep
├── resources/
│ ├── css/
│ │ ├── app.css
│ │ └── editor.css
│ ├── fonts/
│ │ └── .gitkeep
│ ├── images/
│ │ └── .gitkeep
│ ├── js/
│ │ ├── app.js
│ │ └── editor.js
│ └── views/
│ ├── 404.blade.php
│ ├── components/
│ │ └── alert.blade.php
│ ├── forms/
│ │ └── search.blade.php
│ ├── index.blade.php
│ ├── layouts/
│ │ └── app.blade.php
│ ├── page.blade.php
│ ├── partials/
│ │ ├── comments.blade.php
│ │ ├── content-page.blade.php
│ │ ├── content-search.blade.php
│ │ ├── content-single.blade.php
│ │ ├── content.blade.php
│ │ ├── entry-meta.blade.php
│ │ └── page-header.blade.php
│ ├── search.blade.php
│ ├── sections/
│ │ ├── footer.blade.php
│ │ ├── header.blade.php
│ │ └── sidebar.blade.php
│ ├── single.blade.php
│ └── template-custom.blade.php
├── style.css
├── theme.json
└── vite.config.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
quote_type = single
[*.md]
trim_trailing_whitespace = false
[*.php]
indent_size = 4
[*.blade.php]
indent_size = 2
[resources/views/**.php]
indent_size = 2
[index.php]
indent_size = 2
================================================
FILE: .gitattributes
================================================
/.gitattributes export-ignore
/.github export-ignore
================================================
FILE: .github/labeler.yml
================================================
build:
- changed-files:
- any-glob-to-any-file:
- vite.config.js
dependencies:
- changed-files:
- any-glob-to-any-file:
- package-lock.json
javascript:
- changed-files:
- any-glob-to-any-file:
- resources/js/**/*.js
php:
- changed-files:
- any-glob-to-any-file:
- functions.php
- app/**/*.php
- resources/views/**/*.php
views:
- changed-files:
- any-glob-to-any-file:
- index.php
- resources/views/**/*.php
================================================
FILE: .github/renovate.json
================================================
{
"baseBranchPatterns": [
"main"
],
"commitMessageAction": "⬆️ Bump",
"commitMessageTopic": "{{depName}}",
"extends": [
"config:recommended",
"schedule:weekly"
],
"rangeStrategy": "replace",
"ignoreDeps": ["php"],
"packageRules": [
{
"matchUpdateTypes": ["major"],
"enabled": false
},
{
"matchPackageNames": ["node"],
"enabled": false
},
{
"matchManagers": ["composer"],
"matchDepTypes": ["require"],
"matchPackageNames": ["php"],
"enabled": false
},
{
"matchUpdateTypes": [
"minor",
"patch",
"pin"
],
"enabled": true
}
],
"timezone": "America/Detroit"
}
================================================
FILE: .github/workflows/discourse.yml
================================================
name: Post release topic on Discourse
on:
release:
types: [published]
jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: roots/discourse-topic-github-release-action@main
with:
discourse-api-key: ${{ secrets.DISCOURSE_RELEASES_API_KEY }}
discourse-base-url: ${{ secrets.DISCOURSE_BASE_URL }}
github-token: ${{ github.token }}
discourse-category: 11
discourse-tags:
releases
================================================
FILE: .github/workflows/labeler.yml
================================================
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
================================================
FILE: .github/workflows/main.yml
================================================
name: Main
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
node:
name: Node ${{ matrix.node }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
node: ['20']
steps:
- name: Checkout the project
uses: actions/checkout@v4
- name: Setup the Node ${{ matrix.node }} environment on ${{ runner.os }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies using npm
run: npm install
- name: Build and compile assets
run: |
npm run build
cat public/build/manifest.json
- name: Validate theme.json
run: |
THEME_JSON="public/build/assets/theme.json"
if [ ! -f "$THEME_JSON" ]; then
echo "❌ theme.json not found"
exit 1
fi
jq -e '
(.settings.color.palette | length > 0) and
(.settings.typography.fontFamilies | length > 0) and
(.settings.typography.fontSizes | length > 0)
' "$THEME_JSON" 2>&1 || {
echo "❌ Invalid theme.json structure or missing required values"
exit 1
}
php:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php: ['8.2']
steps:
- name: Checkout the project
uses: actions/checkout@v4
- name: Setup the PHP ${{ matrix.php }} environment on ${{ runner.os }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore the Composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-suggest
- name: Run Pint
run: vendor/bin/pint --test
================================================
FILE: .gitignore
================================================
/node_modules
/vendor
/public/*
!/public/.gitkeep
.env
npm-debug.log
================================================
FILE: LICENSE.md
================================================
Copyright (c) Roots Software LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<p align="center">
<a href="https://roots.io/sage/"><img alt="Sage" src="https://cdn.roots.io/app/uploads/logo-sage.svg" height="100"></a>
</p>
<p align="center">
<a href="https://packagist.org/packages/roots/sage"><img alt="Packagist Installs" src="https://img.shields.io/packagist/dt/roots/sage?label=projects%20created&colorB=2b3072&colorA=525ddc&style=flat-square"></a>
<a href="https://github.com/roots/sage/actions/workflows/main.yml"><img alt="Build Status" src="https://img.shields.io/github/actions/workflow/status/roots/sage/main.yml?branch=main&logo=github&label=CI&style=flat-square"></a>
<a href="https://twitter.com/rootswp"><img alt="Follow Roots" src="https://img.shields.io/badge/follow%20@rootswp-1da1f2?logo=twitter&logoColor=ffffff&message=&style=flat-square"></a>
<a href="https://github.com/sponsors/roots"><img src="https://img.shields.io/badge/sponsor%20roots-525ddc?logo=github&style=flat-square&logoColor=ffffff&message=" alt="Sponsor Roots"></a>
</p>
# Sage
**Advanced hybrid WordPress starter theme with Laravel Blade and Tailwind CSS**
- 🔧 Clean, efficient theme templating with Laravel Blade
- ⚡️ Modern front-end development workflow powered by Vite
- 🎨 Out of the box support for Tailwind CSS
- 🚀 Harness the power of Laravel with [Acorn integration](https://github.com/roots/acorn)
- 📦 Block editor support built-in
Sage brings proper PHP templating and modern JavaScript tooling to WordPress themes. Write organized, component-based code using Laravel Blade, enjoy instant builds and CSS hot-reloading with Vite, and leverage Laravel's robust feature set through Acorn.
[Read the docs to get started](https://roots.io/sage/docs/installation/)
## Support us
Roots is an independent open source org, supported only by developers like you. Your sponsorship funds [WP Packages](https://wp-packages.org/) and the entire Roots ecosystem, and keeps them independent. Support us by purchasing [Radicle](https://roots.io/radicle/) or [sponsoring us on GitHub](https://github.com/sponsors/roots) — sponsors get access to our private Discord.
### Sponsors
<a href="https://carrot.com/"><img src="https://cdn.roots.io/app/uploads/carrot.svg" alt="Carrot" width="120" height="90"></a> <a href="https://wordpress.com/"><img src="https://cdn.roots.io/app/uploads/wordpress.svg" alt="WordPress.com" width="120" height="90"></a> <a href="https://www.itineris.co.uk/"><img src="https://cdn.roots.io/app/uploads/itineris.svg" alt="Itineris" width="120" height="90"></a> <a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://cdn.roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="120" height="90"></a> <a href="https://40q.agency/"><img src="https://cdn.roots.io/app/uploads/40q.svg" alt="40Q" width="120" height="90"></a>
## Community
Keep track of development and community news.
- Join us on Discord by [sponsoring us on GitHub](https://github.com/sponsors/roots)
- Join us on [Roots Discourse](https://discourse.roots.io/)
- Follow [@rootswp on Twitter](https://twitter.com/rootswp)
- Follow the [Roots Blog](https://roots.io/blog/)
- Subscribe to the [Roots Newsletter](https://roots.io/subscribe/)
================================================
FILE: app/Providers/ThemeServiceProvider.php
================================================
<?php
namespace App\Providers;
use Roots\Acorn\Sage\SageServiceProvider;
class ThemeServiceProvider extends SageServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
parent::register();
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
}
}
================================================
FILE: app/View/Composers/App.php
================================================
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
class App extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'*',
];
/**
* Retrieve the site name.
*/
public function siteName(): string
{
return get_bloginfo('name', 'display');
}
}
================================================
FILE: app/View/Composers/Comments.php
================================================
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
class Comments extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'partials.comments',
];
/**
* The comment title.
*/
public function title(): string
{
return sprintf(
/* translators: %1$s is replaced with the number of comments and %2$s with the post title */
_nx('%1$s response to “%2$s”', '%1$s responses to “%2$s”', get_comments_number(), 'comments title', 'sage'),
get_comments_number() === 1 ? _x('One', 'comments title', 'sage') : number_format_i18n(get_comments_number()),
get_the_title()
);
}
/**
* Retrieve the comments.
*/
public function responses(): ?string
{
if (! have_comments()) {
return null;
}
return wp_list_comments([
'style' => 'ol',
'short_ping' => true,
'echo' => false,
]);
}
/**
* The previous comments link.
*/
public function previous(): ?string
{
if (! get_previous_comments_link()) {
return null;
}
return get_previous_comments_link(
__('← Older comments', 'sage')
);
}
/**
* The next comments link.
*/
public function next(): ?string
{
if (! get_next_comments_link()) {
return null;
}
return get_next_comments_link(
__('Newer comments →', 'sage')
);
}
/**
* Determine if the comments are paginated.
*/
public function paginated(): bool
{
return get_comment_pages_count() > 1 && get_option('page_comments');
}
/**
* Determine if the comments are closed.
*/
public function closed(): bool
{
return ! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments');
}
}
================================================
FILE: app/View/Composers/Post.php
================================================
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
class Post extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'partials.page-header',
'partials.content',
'partials.content-*',
];
/**
* Retrieve the post title.
*/
public function title(): string
{
if ($this->view->name() !== 'partials.page-header') {
return get_the_title();
}
if (is_home()) {
if ($home = get_option('page_for_posts', true)) {
return get_the_title($home);
}
return __('Latest Posts', 'sage');
}
if (is_archive()) {
return get_the_archive_title();
}
if (is_search()) {
return sprintf(
/* translators: %s is replaced with the search query */
__('Search Results for %s', 'sage'),
get_search_query()
);
}
if (is_404()) {
return __('Not Found', 'sage');
}
return get_the_title();
}
/**
* Retrieve the pagination links.
*/
public function pagination(): string
{
return wp_link_pages([
'echo' => 0,
'before' => '<p>'.__('Pages:', 'sage'),
'after' => '</p>',
]);
}
}
================================================
FILE: app/filters.php
================================================
<?php
/**
* Theme filters.
*/
namespace App;
/**
* Add "… Continued" to the excerpt.
*
* @return string
*/
add_filter('excerpt_more', function () {
return sprintf(' … <a href="%s">%s</a>', get_permalink(), __('Continued', 'sage'));
});
================================================
FILE: app/setup.php
================================================
<?php
/**
* Theme setup.
*/
namespace App;
use Illuminate\Support\Facades\Vite;
/**
* Inject styles into the block editor.
*
* @return array
*/
add_filter('block_editor_settings_all', function ($settings) {
$style = Vite::asset('resources/css/editor.css');
$settings['styles'][] = [
'css' => "@import url('{$style}')",
];
return $settings;
});
/**
* Inject scripts into the block editor.
*
* @return void
*/
add_action('admin_head', function () {
if (! get_current_screen()?->is_block_editor()) {
return;
}
if (! Vite::isRunningHot()) {
$dependencies = json_decode(Vite::content('editor.deps.json'));
foreach ($dependencies as $dependency) {
if (! wp_script_is($dependency)) {
wp_enqueue_script($dependency);
}
}
}
echo Vite::withEntryPoints([
'resources/js/editor.js',
])->toHtml();
});
/**
* Use the generated theme.json file.
*
* @return string
*/
add_filter('theme_file_path', function ($path, $file) {
return $file === 'theme.json'
? public_path('build/assets/theme.json')
: $path;
}, 10, 2);
/**
* Disable on-demand block asset loading.
*
* @link https://core.trac.wordpress.org/ticket/61965
*/
add_filter('should_load_separate_core_block_assets', '__return_false');
/**
* Register the initial theme setup.
*
* @return void
*/
add_action('after_setup_theme', function () {
/**
* Disable full-site editing support.
*
* @link https://wptavern.com/gutenberg-10-5-embeds-pdfs-adds-verse-block-color-options-and-introduces-new-patterns
*/
remove_theme_support('block-templates');
/**
* Register the navigation menus.
*
* @link https://developer.wordpress.org/reference/functions/register_nav_menus/
*/
register_nav_menus([
'primary_navigation' => __('Primary Navigation', 'sage'),
]);
/**
* Disable the default block patterns.
*
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#disabling-the-default-block-patterns
*/
remove_theme_support('core-block-patterns');
/**
* Enable plugins to manage the document title.
*
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#title-tag
*/
add_theme_support('title-tag');
/**
* Enable post thumbnail support.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support('post-thumbnails');
/**
* Enable responsive embed support.
*
* @link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#responsive-embedded-content
*/
add_theme_support('responsive-embeds');
/**
* Enable HTML5 markup support.
*
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5
*/
add_theme_support('html5', [
'caption',
'comment-form',
'comment-list',
'gallery',
'search-form',
'script',
'style',
]);
/**
* Enable selective refresh for widgets in customizer.
*
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#customize-selective-refresh-widgets
*/
add_theme_support('customize-selective-refresh-widgets');
}, 20);
/**
* Register the theme sidebars.
*
* @return void
*/
add_action('widgets_init', function () {
$config = [
'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>',
];
register_sidebar([
'name' => __('Primary', 'sage'),
'id' => 'sidebar-primary',
] + $config);
register_sidebar([
'name' => __('Footer', 'sage'),
'id' => 'sidebar-footer',
] + $config);
});
================================================
FILE: composer.json
================================================
{
"name": "roots/sage",
"type": "wordpress-theme",
"license": "MIT",
"description": "WordPress starter theme with a modern development workflow",
"homepage": "https://roots.io/sage/",
"authors": [
{
"name": "Ben Word",
"email": "ben@benword.com",
"homepage": "https://github.com/retlehs"
},
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",
"homepage": "https://github.com/swalkinshaw"
},
{
"name": "QWp6t",
"email": "hi@qwp6t.me",
"homepage": "https://github.com/qwp6t"
},
{
"name": "Brandon Nifong",
"email": "brandon@tendency.me",
"homepage": "https://github.com/log1x"
}
],
"keywords": [
"wordpress"
],
"support": {
"issues": "https://github.com/roots/sage/issues",
"forum": "https://discourse.roots.io/"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"require": {
"php": ">=8.2",
"roots/acorn": "^5.0"
},
"require-dev": {
"laravel/pint": "^1.20"
},
"suggest": {
"log1x/sage-directives": "A collection of useful Blade directives for WordPress and Sage (^1.0)."
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Roots\\Acorn\\ComposerScripts::postAutoloadDump"
]
}
}
================================================
FILE: functions.php
================================================
<?php
use App\Providers\ThemeServiceProvider;
use Roots\Acorn\Application;
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our theme. We will simply require it into the script here so that we
| don't have to worry about manually loading any of our classes later on.
|
*/
if (! file_exists($composer = __DIR__.'/vendor/autoload.php')) {
wp_die(__('Error locating autoloader. Please run <code>composer install</code>.', 'sage'));
}
require $composer;
/*
|--------------------------------------------------------------------------
| Register The Bootloader
|--------------------------------------------------------------------------
|
| The first thing we will do is schedule a new Acorn application container
| to boot when WordPress is finished loading the theme. The application
| serves as the "glue" for all the components of Laravel and is
| the IoC container for the system binding all of the various parts.
|
*/
Application::configure()
->withProviders([
ThemeServiceProvider::class,
])
->boot();
/*
|--------------------------------------------------------------------------
| Register Sage Theme Files
|--------------------------------------------------------------------------
|
| Out of the box, Sage ships with categorically named theme files
| containing common functionality and setup to be bootstrapped with your
| theme. Simply add (or remove) files from the array below to change what
| is registered alongside Sage.
|
*/
collect(['setup', 'filters'])
->each(function ($file) {
if (! locate_template($file = "app/{$file}.php", true, true)) {
wp_die(
/* translators: %s is replaced with the relative file path */
sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file)
);
}
});
================================================
FILE: index.php
================================================
<?php
echo view(app('sage.view'), app('sage.data'))->render();
================================================
FILE: package.json
================================================
{
"name": "sage",
"private": true,
"engines": {
"node": ">=20.0.0"
},
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"translate": "npm run translate:pot && npm run translate:update",
"translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --include=\"theme.json,patterns,app,resources\"",
"translate:update": "for file in ./resources/lang/*.po; do wp i18n update-po ./resources/lang/sage.pot $file; done",
"translate:compile": "npm run translate:mo && npm run translate:js",
"translate:js": "wp i18n make-json ./resources/lang --pretty-print",
"translate:mo": "wp i18n make-mo ./resources/lang ./resources/lang"
},
"devDependencies": {
"@roots/vite-plugin": "^1.0.0",
"@tailwindcss/vite": "^4.0.0",
"laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0",
"vite": "^7.0.0"
}
}
================================================
FILE: public/.gitkeep
================================================
================================================
FILE: resources/css/app.css
================================================
@import "tailwindcss" theme(static);
@source "../../app/**/*.php";
@source "../**/*.blade.php";
@source "../**/*.js";
================================================
FILE: resources/css/editor.css
================================================
@import "tailwindcss";
================================================
FILE: resources/fonts/.gitkeep
================================================
================================================
FILE: resources/images/.gitkeep
================================================
================================================
FILE: resources/js/app.js
================================================
import.meta.glob([
'../images/**',
'../fonts/**',
]);
================================================
FILE: resources/js/editor.js
================================================
import domReady from '@wordpress/dom-ready';
domReady(() => {
//
});
================================================
FILE: resources/views/404.blade.php
================================================
@extends('layouts.app')
@section('content')
@include('partials.page-header')
@if (! have_posts())
<x-alert type="warning">
{!! __('Sorry, but the page you are trying to view does not exist.', 'sage') !!}
</x-alert>
{!! get_search_form(false) !!}
@endif
@endsection
================================================
FILE: resources/views/components/alert.blade.php
================================================
@props([
'type' => null,
'message' => null,
])
@php($class = match ($type) {
'success' => 'text-green-50 bg-green-400',
'caution' => 'text-yellow-50 bg-yellow-400',
'warning' => 'text-red-50 bg-red-400',
default => 'text-indigo-50 bg-indigo-400',
})
<div {{ $attributes->merge(['class' => "px-2 py-1 {$class}"]) }}>
{!! $message ?? $slot !!}
</div>
================================================
FILE: resources/views/forms/search.blade.php
================================================
<form role="search" method="get" class="search-form" action="{{ home_url('/') }}">
<label>
<span class="sr-only">
{{ _x('Search for:', 'label', 'sage') }}
</span>
<input
type="search"
placeholder="{!! esc_attr_x('Search …', 'placeholder', 'sage') !!}"
value="{{ get_search_query() }}"
name="s"
>
</label>
<button>{{ _x('Search', 'submit button', 'sage') }}</button>
</form>
================================================
FILE: resources/views/index.blade.php
================================================
@extends('layouts.app')
@section('content')
@include('partials.page-header')
@if (! have_posts())
<x-alert type="warning">
{!! __('Sorry, no results were found.', 'sage') !!}
</x-alert>
{!! get_search_form(false) !!}
@endif
@while(have_posts()) @php(the_post())
@includeFirst(['partials.content-' . get_post_type(), 'partials.content'])
@endwhile
{!! get_the_posts_navigation() !!}
@endsection
@section('sidebar')
@include('sections.sidebar')
@endsection
================================================
FILE: resources/views/layouts/app.blade.php
================================================
<!doctype html>
<html @php(language_attributes())>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@php(do_action('get_header'))
@php(wp_head())
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body @php(body_class())>
@php(wp_body_open())
<div id="app">
<a class="sr-only focus:not-sr-only" href="#main">
{{ __('Skip to content', 'sage') }}
</a>
@include('sections.header')
<main id="main" class="main">
@yield('content')
</main>
@hasSection('sidebar')
<aside class="sidebar">
@yield('sidebar')
</aside>
@endif
@include('sections.footer')
</div>
@php(do_action('get_footer'))
@php(wp_footer())
</body>
</html>
================================================
FILE: resources/views/page.blade.php
================================================
@extends('layouts.app')
@section('content')
@while(have_posts()) @php(the_post())
@include('partials.page-header')
@includeFirst(['partials.content-page', 'partials.content'])
@endwhile
@endsection
================================================
FILE: resources/views/partials/comments.blade.php
================================================
@if (! post_password_required())
<section id="comments" class="comments">
@if ($responses())
<h2>
{!! $title !!}
</h2>
<ol class="comment-list">
{!! $responses !!}
</ol>
@if ($paginated())
<nav aria-label="Comment">
<ul class="pager">
@if ($previous())
<li class="previous">
{!! $previous !!}
</li>
@endif
@if ($next())
<li class="next">
{!! $next !!}
</li>
@endif
</ul>
</nav>
@endif
@endif
@if ($closed())
<x-alert type="warning">
{!! __('Comments are closed.', 'sage') !!}
</x-alert>
@endif
@php(comment_form())
</section>
@endif
================================================
FILE: resources/views/partials/content-page.blade.php
================================================
@php(the_content())
@if ($pagination())
<nav class="page-nav" aria-label="Page">
{!! $pagination !!}
</nav>
@endif
================================================
FILE: resources/views/partials/content-search.blade.php
================================================
<article @php(post_class())>
<header>
<h2 class="entry-title">
<a href="{{ get_permalink() }}">
{!! $title !!}
</a>
</h2>
@includeWhen(get_post_type() === 'post', 'partials.entry-meta')
</header>
<div class="entry-summary">
@php(the_excerpt())
</div>
</article>
================================================
FILE: resources/views/partials/content-single.blade.php
================================================
<article @php(post_class('h-entry'))>
<header>
<h1 class="p-name">
{!! $title !!}
</h1>
@include('partials.entry-meta')
</header>
<div class="e-content">
@php(the_content())
</div>
@if ($pagination())
<footer>
<nav class="page-nav" aria-label="Page">
{!! $pagination !!}
</nav>
</footer>
@endif
@php(comments_template())
</article>
================================================
FILE: resources/views/partials/content.blade.php
================================================
<article @php(post_class())>
<header>
<h2 class="entry-title">
<a href="{{ get_permalink() }}">
{!! $title !!}
</a>
</h2>
@include('partials.entry-meta')
</header>
<div class="entry-summary">
@php(the_excerpt())
</div>
</article>
================================================
FILE: resources/views/partials/entry-meta.blade.php
================================================
<time class="dt-published" datetime="{{ get_post_time('c', true) }}">
{{ get_the_date() }}
</time>
<p>
<span>{{ __('By', 'sage') }}</span>
<a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" class="p-author h-card">
{{ get_the_author() }}
</a>
</p>
================================================
FILE: resources/views/partials/page-header.blade.php
================================================
<div class="page-header">
<h1>{!! $title !!}</h1>
</div>
================================================
FILE: resources/views/search.blade.php
================================================
@extends('layouts.app')
@section('content')
@include('partials.page-header')
@if (! have_posts())
<x-alert type="warning">
{!! __('Sorry, no results were found.', 'sage') !!}
</x-alert>
{!! get_search_form(false) !!}
@endif
@while(have_posts()) @php(the_post())
@include('partials.content-search')
@endwhile
{!! get_the_posts_navigation() !!}
@endsection
================================================
FILE: resources/views/sections/footer.blade.php
================================================
<footer class="content-info">
@php(dynamic_sidebar('sidebar-footer'))
</footer>
================================================
FILE: resources/views/sections/header.blade.php
================================================
<header class="banner">
<a class="brand" href="{{ home_url('/') }}">
{!! $siteName !!}
</a>
@if (has_nav_menu('primary_navigation'))
<nav class="nav-primary" aria-label="{{ wp_get_nav_menu_name('primary_navigation') }}">
{!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav', 'echo' => false]) !!}
</nav>
@endif
</header>
================================================
FILE: resources/views/sections/sidebar.blade.php
================================================
@php(dynamic_sidebar('sidebar-primary'))
================================================
FILE: resources/views/single.blade.php
================================================
@extends('layouts.app')
@section('content')
@while(have_posts()) @php(the_post())
@includeFirst(['partials.content-single-' . get_post_type(), 'partials.content-single'])
@endwhile
@endsection
================================================
FILE: resources/views/template-custom.blade.php
================================================
{{--
Template Name: Custom Template
--}}
@extends('layouts.app')
@section('content')
@while(have_posts()) @php(the_post())
@include('partials.page-header')
@include('partials.content-page')
@endwhile
@endsection
================================================
FILE: style.css
================================================
/*
Theme Name: Sage Starter Theme
Theme URI: https://roots.io/sage/
Description: Sage is a WordPress starter theme.
Version: 11.x-dev
Author: Roots
Author URI: https://roots.io/
Text Domain: sage
License: MIT License
License URI: https://opensource.org/licenses/MIT
Requires PHP: 8.2
Requires at least: 6.6
*/
================================================
FILE: theme.json
================================================
{
"__preprocessed__": "This file is used to build the theme.json file in the `public/build/assets` directory. The built artifact includes Tailwind's colors, fonts, and font sizes.",
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"settings": {
"layout": {
"contentSize": "48rem"
},
"background": {
"backgroundImage": true
},
"color": {
"custom": false,
"customDuotone": false,
"customGradient": false,
"defaultDuotone": false,
"defaultGradients": false,
"defaultPalette": false,
"duotone": []
},
"custom": {
"spacing": {},
"typography": {
"font-size": {},
"line-height": {}
}
},
"spacing": {
"padding": true,
"units": ["px", "%", "em", "rem", "vw", "vh"]
},
"typography": {
"defaultFontSizes": false,
"customFontSize": false
}
}
}
================================================
FILE: vite.config.js
================================================
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite';
import laravel from 'laravel-vite-plugin'
import { wordpressPlugin, wordpressThemeJson } from '@roots/vite-plugin';
// Set APP_URL if it doesn't exist for Laravel Vite plugin
if (! process.env.APP_URL) {
process.env.APP_URL = 'http://example.test';
}
export default defineConfig({
base: '/app/themes/sage/public/build/',
plugins: [
tailwindcss(),
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
'resources/css/editor.css',
'resources/js/editor.js',
],
refresh: true,
}),
wordpressPlugin(),
// Generate the theme.json file in the public/build/assets directory
// based on the Tailwind config and the theme.json file from base theme folder
wordpressThemeJson({
disableTailwindColors: false,
disableTailwindFonts: false,
disableTailwindFontSizes: false,
disableTailwindBorderRadius: false,
}),
],
resolve: {
alias: {
'@scripts': '/resources/js',
'@styles': '/resources/css',
'@fonts': '/resources/fonts',
'@images': '/resources/images',
},
},
})
gitextract_mlgy7jua/ ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── labeler.yml │ ├── renovate.json │ └── workflows/ │ ├── discourse.yml │ ├── labeler.yml │ └── main.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── app/ │ ├── Providers/ │ │ └── ThemeServiceProvider.php │ ├── View/ │ │ └── Composers/ │ │ ├── App.php │ │ ├── Comments.php │ │ └── Post.php │ ├── filters.php │ └── setup.php ├── composer.json ├── functions.php ├── index.php ├── package.json ├── public/ │ └── .gitkeep ├── resources/ │ ├── css/ │ │ ├── app.css │ │ └── editor.css │ ├── fonts/ │ │ └── .gitkeep │ ├── images/ │ │ └── .gitkeep │ ├── js/ │ │ ├── app.js │ │ └── editor.js │ └── views/ │ ├── 404.blade.php │ ├── components/ │ │ └── alert.blade.php │ ├── forms/ │ │ └── search.blade.php │ ├── index.blade.php │ ├── layouts/ │ │ └── app.blade.php │ ├── page.blade.php │ ├── partials/ │ │ ├── comments.blade.php │ │ ├── content-page.blade.php │ │ ├── content-search.blade.php │ │ ├── content-single.blade.php │ │ ├── content.blade.php │ │ ├── entry-meta.blade.php │ │ └── page-header.blade.php │ ├── search.blade.php │ ├── sections/ │ │ ├── footer.blade.php │ │ ├── header.blade.php │ │ └── sidebar.blade.php │ ├── single.blade.php │ └── template-custom.blade.php ├── style.css ├── theme.json └── vite.config.js
SYMBOL INDEX (15 symbols across 4 files)
FILE: app/Providers/ThemeServiceProvider.php
class ThemeServiceProvider (line 7) | class ThemeServiceProvider extends SageServiceProvider
method register (line 14) | public function register()
method boot (line 24) | public function boot()
FILE: app/View/Composers/App.php
class App (line 7) | class App extends Composer
method siteName (line 21) | public function siteName(): string
FILE: app/View/Composers/Comments.php
class Comments (line 7) | class Comments extends Composer
method title (line 21) | public function title(): string
method responses (line 34) | public function responses(): ?string
method previous (line 50) | public function previous(): ?string
method next (line 64) | public function next(): ?string
method paginated (line 78) | public function paginated(): bool
method closed (line 86) | public function closed(): bool
FILE: app/View/Composers/Post.php
class Post (line 7) | class Post extends Composer
method title (line 23) | public function title(): string
method pagination (line 59) | public function pagination(): string
Condensed preview — 49 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (36K chars).
[
{
"path": ".editorconfig",
"chars": 335,
"preview": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\ntrim_"
},
{
"path": ".gitattributes",
"chars": 53,
"preview": "/.gitattributes export-ignore\n/.github export-ignore\n"
},
{
"path": ".github/labeler.yml",
"chars": 527,
"preview": "build:\n - changed-files:\n - any-glob-to-any-file:\n - vite.config.js\ndependencies:\n - changed-files:\n "
},
{
"path": ".github/renovate.json",
"chars": 711,
"preview": "{\n \"baseBranchPatterns\": [\n \"main\"\n ],\n \"commitMessageAction\": \"⬆️ Bump\",\n \"commitMessageTopic\": \"{{depName}}\",\n "
},
{
"path": ".github/workflows/discourse.yml",
"chars": 450,
"preview": "name: Post release topic on Discourse\n\non:\n release:\n types: [published]\n\njobs:\n post:\n runs-on: ubuntu-latest\n "
},
{
"path": ".github/workflows/labeler.yml",
"chars": 203,
"preview": "name: \"Pull Request Labeler\"\non:\n- pull_request_target\n\njobs:\n triage:\n runs-on: ubuntu-latest\n steps:\n - uses"
},
{
"path": ".github/workflows/main.yml",
"chars": 2511,
"preview": "name: Main\n\non:\n push:\n branches:\n - main\n pull_request:\n branches:\n - main\n\njobs:\n node:\n name: N"
},
{
"path": ".gitignore",
"chars": 69,
"preview": "/node_modules\n/vendor\n/public/*\n!/public/.gitkeep\n.env\nnpm-debug.log\n"
},
{
"path": "LICENSE.md",
"chars": 1057,
"preview": "Copyright (c) Roots Software LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis s"
},
{
"path": "README.md",
"chars": 3155,
"preview": "<p align=\"center\">\n <a href=\"https://roots.io/sage/\"><img alt=\"Sage\" src=\"https://cdn.roots.io/app/uploads/logo-sage.sv"
},
{
"path": "app/Providers/ThemeServiceProvider.php",
"chars": 441,
"preview": "<?php\n\nnamespace App\\Providers;\n\nuse Roots\\Acorn\\Sage\\SageServiceProvider;\n\nclass ThemeServiceProvider extends SageServi"
},
{
"path": "app/View/Composers/App.php",
"chars": 387,
"preview": "<?php\n\nnamespace App\\View\\Composers;\n\nuse Roots\\Acorn\\View\\Composer;\n\nclass App extends Composer\n{\n /**\n * List o"
},
{
"path": "app/View/Composers/Comments.php",
"chars": 2073,
"preview": "<?php\n\nnamespace App\\View\\Composers;\n\nuse Roots\\Acorn\\View\\Composer;\n\nclass Comments extends Composer\n{\n /**\n * L"
},
{
"path": "app/View/Composers/Post.php",
"chars": 1423,
"preview": "<?php\n\nnamespace App\\View\\Composers;\n\nuse Roots\\Acorn\\View\\Composer;\n\nclass Post extends Composer\n{\n /**\n * List "
},
{
"path": "app/filters.php",
"chars": 256,
"preview": "<?php\n\n/**\n * Theme filters.\n */\n\nnamespace App;\n\n/**\n * Add \"… Continued\" to the excerpt.\n *\n * @return string\n */\nadd_"
},
{
"path": "app/setup.php",
"chars": 3963,
"preview": "<?php\n\n/**\n * Theme setup.\n */\n\nnamespace App;\n\nuse Illuminate\\Support\\Facades\\Vite;\n\n/**\n * Inject styles into the bloc"
},
{
"path": "composer.json",
"chars": 1450,
"preview": "{\n \"name\": \"roots/sage\",\n \"type\": \"wordpress-theme\",\n \"license\": \"MIT\",\n \"description\": \"WordPress starter theme wit"
},
{
"path": "functions.php",
"chars": 2037,
"preview": "<?php\n\nuse App\\Providers\\ThemeServiceProvider;\nuse Roots\\Acorn\\Application;\n\n/*\n|---------------------------------------"
},
{
"path": "index.php",
"chars": 64,
"preview": "<?php\n\necho view(app('sage.view'), app('sage.data'))->render();\n"
},
{
"path": "package.json",
"chars": 881,
"preview": "{\n \"name\": \"sage\",\n \"private\": true,\n \"engines\": {\n \"node\": \">=20.0.0\"\n },\n \"type\": \"module\",\n \"scripts\": {\n "
},
{
"path": "public/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "resources/css/app.css",
"chars": 118,
"preview": "@import \"tailwindcss\" theme(static);\n@source \"../../app/**/*.php\";\n@source \"../**/*.blade.php\";\n@source \"../**/*.js\";\n"
},
{
"path": "resources/css/editor.css",
"chars": 23,
"preview": "@import \"tailwindcss\";\n"
},
{
"path": "resources/fonts/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "resources/images/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "resources/js/app.js",
"chars": 62,
"preview": "import.meta.glob([\r\n '../images/**',\r\n '../fonts/**',\r\n]);\r\n"
},
{
"path": "resources/js/editor.js",
"chars": 72,
"preview": "import domReady from '@wordpress/dom-ready';\n\ndomReady(() => {\n //\n});\n"
},
{
"path": "resources/views/404.blade.php",
"chars": 292,
"preview": "@extends('layouts.app')\n\n@section('content')\n @include('partials.page-header')\n\n @if (! have_posts())\n <x-alert typ"
},
{
"path": "resources/views/components/alert.blade.php",
"chars": 365,
"preview": "@props([\n 'type' => null,\n 'message' => null,\n])\n\n@php($class = match ($type) {\n 'success' => 'text-green-50 bg-green"
},
{
"path": "resources/views/forms/search.blade.php",
"chars": 435,
"preview": "<form role=\"search\" method=\"get\" class=\"search-form\" action=\"{{ home_url('/') }}\">\n <label>\n <span class=\"sr-only\">\n"
},
{
"path": "resources/views/index.blade.php",
"chars": 497,
"preview": "@extends('layouts.app')\n\n@section('content')\n @include('partials.page-header')\n\n @if (! have_posts())\n <x-alert typ"
},
{
"path": "resources/views/layouts/app.blade.php",
"chars": 824,
"preview": "<!doctype html>\n<html @php(language_attributes())>\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content"
},
{
"path": "resources/views/page.blade.php",
"chars": 211,
"preview": "@extends('layouts.app')\n\n@section('content')\n @while(have_posts()) @php(the_post())\n @include('partials.page-header'"
},
{
"path": "resources/views/partials/comments.blade.php",
"chars": 806,
"preview": "@if (! post_password_required())\n <section id=\"comments\" class=\"comments\">\n @if ($responses())\n <h2>\n {!"
},
{
"path": "resources/views/partials/content-page.blade.php",
"chars": 124,
"preview": "@php(the_content())\n\n@if ($pagination())\n <nav class=\"page-nav\" aria-label=\"Page\">\n {!! $pagination !!}\n </nav>\n@en"
},
{
"path": "resources/views/partials/content-search.blade.php",
"chars": 308,
"preview": "<article @php(post_class())>\n <header>\n <h2 class=\"entry-title\">\n <a href=\"{{ get_permalink() }}\">\n {!! "
},
{
"path": "resources/views/partials/content-single.blade.php",
"chars": 400,
"preview": "<article @php(post_class('h-entry'))>\n <header>\n <h1 class=\"p-name\">\n {!! $title !!}\n </h1>\n\n @include('p"
},
{
"path": "resources/views/partials/content.blade.php",
"chars": 276,
"preview": "<article @php(post_class())>\n <header>\n <h2 class=\"entry-title\">\n <a href=\"{{ get_permalink() }}\">\n {!! "
},
{
"path": "resources/views/partials/entry-meta.blade.php",
"chars": 274,
"preview": "<time class=\"dt-published\" datetime=\"{{ get_post_time('c', true) }}\">\n {{ get_the_date() }}\n</time>\n\n<p>\n <span>{{ __("
},
{
"path": "resources/views/partials/page-header.blade.php",
"chars": 59,
"preview": "<div class=\"page-header\">\n <h1>{!! $title !!}</h1>\n</div>\n"
},
{
"path": "resources/views/search.blade.php",
"chars": 394,
"preview": "@extends('layouts.app')\n\n@section('content')\n @include('partials.page-header')\n\n @if (! have_posts())\n <x-alert typ"
},
{
"path": "resources/views/sections/footer.blade.php",
"chars": 82,
"preview": "<footer class=\"content-info\">\n @php(dynamic_sidebar('sidebar-footer'))\n</footer>\n"
},
{
"path": "resources/views/sections/header.blade.php",
"chars": 376,
"preview": "<header class=\"banner\">\n <a class=\"brand\" href=\"{{ home_url('/') }}\">\n {!! $siteName !!}\n </a>\n\n @if (has_nav_menu"
},
{
"path": "resources/views/sections/sidebar.blade.php",
"chars": 41,
"preview": "@php(dynamic_sidebar('sidebar-primary'))\n"
},
{
"path": "resources/views/single.blade.php",
"chars": 202,
"preview": "@extends('layouts.app')\n\n@section('content')\n @while(have_posts()) @php(the_post())\n @includeFirst(['partials.conten"
},
{
"path": "resources/views/template-custom.blade.php",
"chars": 228,
"preview": "{{--\n Template Name: Custom Template\n--}}\n\n@extends('layouts.app')\n\n@section('content')\n @while(have_posts()) @php(the"
},
{
"path": "style.css",
"chars": 397,
"preview": "/*\nTheme Name: Sage Starter Theme\nTheme URI: https://roots.io/sage/\nDescription: Sage is a WordP"
},
{
"path": "theme.json",
"chars": 921,
"preview": "{\n \"__preprocessed__\": \"This file is used to build the theme.json file in the `public/build/assets` directory. The buil"
},
{
"path": "vite.config.js",
"chars": 1197,
"preview": "import { defineConfig } from 'vite'\nimport tailwindcss from '@tailwindcss/vite';\nimport laravel from 'laravel-vite-plugi"
}
]
About this extraction
This page contains the full source code of the roots/sage GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 49 files (30.3 KB), approximately 9.0k tokens, and a symbol index with 15 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.