From 81655d2167f90db42f6dd72f096c861c9ce7b828 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 21:51:31 +0000 Subject: [PATCH 01/19] chore: rename directories `styles` and `scripts` to `scss` and `js` respectively. Also auto formatting. --- resources/{scripts => js}/main.js | 0 .../{scripts => js}/templates/front-page.js | 0 .../templates/template-contact.js | 0 resources/{styles => scss}/common/_fonts.scss | 0 .../{styles => scss}/common/_global.scss | 0 .../{styles => scss}/common/_mixins.scss | 0 resources/{styles => scss}/common/_reset.scss | 0 .../{styles => scss}/common/_variables.scss | 0 .../{styles => scss}/components/_buttons.scss | 0 .../{styles => scss}/components/_cards.scss | 0 .../components/_comments.scss | 0 .../{styles => scss}/components/_forms.scss | 0 .../components/_wp-classes.scss | 0 resources/{styles => scss}/critical.scss | 0 .../{styles => scss}/layouts/_footer.scss | 0 .../{styles => scss}/layouts/_header.scss | 0 .../{styles => scss}/layouts/_posts.scss | 0 .../{styles => scss}/layouts/_sidebar.scss | 0 .../{styles => scss}/layouts/_tinymce.scss | 0 resources/{styles => scss}/main.scss | 0 .../{styles => scss}/pages/_landing-page.scss | 0 resources/{styles => scss}/pages/_pages.scss | 0 webpack.mix.js | 63 ++++++++++--------- 23 files changed, 32 insertions(+), 31 deletions(-) rename resources/{scripts => js}/main.js (100%) rename resources/{scripts => js}/templates/front-page.js (100%) rename resources/{scripts => js}/templates/template-contact.js (100%) rename resources/{styles => scss}/common/_fonts.scss (100%) rename resources/{styles => scss}/common/_global.scss (100%) rename resources/{styles => scss}/common/_mixins.scss (100%) rename resources/{styles => scss}/common/_reset.scss (100%) rename resources/{styles => scss}/common/_variables.scss (100%) rename resources/{styles => scss}/components/_buttons.scss (100%) rename resources/{styles => scss}/components/_cards.scss (100%) rename resources/{styles => scss}/components/_comments.scss (100%) rename resources/{styles => scss}/components/_forms.scss (100%) rename resources/{styles => scss}/components/_wp-classes.scss (100%) rename resources/{styles => scss}/critical.scss (100%) rename resources/{styles => scss}/layouts/_footer.scss (100%) rename resources/{styles => scss}/layouts/_header.scss (100%) rename resources/{styles => scss}/layouts/_posts.scss (100%) rename resources/{styles => scss}/layouts/_sidebar.scss (100%) rename resources/{styles => scss}/layouts/_tinymce.scss (100%) rename resources/{styles => scss}/main.scss (100%) rename resources/{styles => scss}/pages/_landing-page.scss (100%) rename resources/{styles => scss}/pages/_pages.scss (100%) diff --git a/resources/scripts/main.js b/resources/js/main.js similarity index 100% rename from resources/scripts/main.js rename to resources/js/main.js diff --git a/resources/scripts/templates/front-page.js b/resources/js/templates/front-page.js similarity index 100% rename from resources/scripts/templates/front-page.js rename to resources/js/templates/front-page.js diff --git a/resources/scripts/templates/template-contact.js b/resources/js/templates/template-contact.js similarity index 100% rename from resources/scripts/templates/template-contact.js rename to resources/js/templates/template-contact.js diff --git a/resources/styles/common/_fonts.scss b/resources/scss/common/_fonts.scss similarity index 100% rename from resources/styles/common/_fonts.scss rename to resources/scss/common/_fonts.scss diff --git a/resources/styles/common/_global.scss b/resources/scss/common/_global.scss similarity index 100% rename from resources/styles/common/_global.scss rename to resources/scss/common/_global.scss diff --git a/resources/styles/common/_mixins.scss b/resources/scss/common/_mixins.scss similarity index 100% rename from resources/styles/common/_mixins.scss rename to resources/scss/common/_mixins.scss diff --git a/resources/styles/common/_reset.scss b/resources/scss/common/_reset.scss similarity index 100% rename from resources/styles/common/_reset.scss rename to resources/scss/common/_reset.scss diff --git a/resources/styles/common/_variables.scss b/resources/scss/common/_variables.scss similarity index 100% rename from resources/styles/common/_variables.scss rename to resources/scss/common/_variables.scss diff --git a/resources/styles/components/_buttons.scss b/resources/scss/components/_buttons.scss similarity index 100% rename from resources/styles/components/_buttons.scss rename to resources/scss/components/_buttons.scss diff --git a/resources/styles/components/_cards.scss b/resources/scss/components/_cards.scss similarity index 100% rename from resources/styles/components/_cards.scss rename to resources/scss/components/_cards.scss diff --git a/resources/styles/components/_comments.scss b/resources/scss/components/_comments.scss similarity index 100% rename from resources/styles/components/_comments.scss rename to resources/scss/components/_comments.scss diff --git a/resources/styles/components/_forms.scss b/resources/scss/components/_forms.scss similarity index 100% rename from resources/styles/components/_forms.scss rename to resources/scss/components/_forms.scss diff --git a/resources/styles/components/_wp-classes.scss b/resources/scss/components/_wp-classes.scss similarity index 100% rename from resources/styles/components/_wp-classes.scss rename to resources/scss/components/_wp-classes.scss diff --git a/resources/styles/critical.scss b/resources/scss/critical.scss similarity index 100% rename from resources/styles/critical.scss rename to resources/scss/critical.scss diff --git a/resources/styles/layouts/_footer.scss b/resources/scss/layouts/_footer.scss similarity index 100% rename from resources/styles/layouts/_footer.scss rename to resources/scss/layouts/_footer.scss diff --git a/resources/styles/layouts/_header.scss b/resources/scss/layouts/_header.scss similarity index 100% rename from resources/styles/layouts/_header.scss rename to resources/scss/layouts/_header.scss diff --git a/resources/styles/layouts/_posts.scss b/resources/scss/layouts/_posts.scss similarity index 100% rename from resources/styles/layouts/_posts.scss rename to resources/scss/layouts/_posts.scss diff --git a/resources/styles/layouts/_sidebar.scss b/resources/scss/layouts/_sidebar.scss similarity index 100% rename from resources/styles/layouts/_sidebar.scss rename to resources/scss/layouts/_sidebar.scss diff --git a/resources/styles/layouts/_tinymce.scss b/resources/scss/layouts/_tinymce.scss similarity index 100% rename from resources/styles/layouts/_tinymce.scss rename to resources/scss/layouts/_tinymce.scss diff --git a/resources/styles/main.scss b/resources/scss/main.scss similarity index 100% rename from resources/styles/main.scss rename to resources/scss/main.scss diff --git a/resources/styles/pages/_landing-page.scss b/resources/scss/pages/_landing-page.scss similarity index 100% rename from resources/styles/pages/_landing-page.scss rename to resources/scss/pages/_landing-page.scss diff --git a/resources/styles/pages/_pages.scss b/resources/scss/pages/_pages.scss similarity index 100% rename from resources/styles/pages/_pages.scss rename to resources/scss/pages/_pages.scss diff --git a/webpack.mix.js b/webpack.mix.js index 34c7eb9da2..f817e16449 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -1,6 +1,6 @@ -const mix = require("laravel-mix"); -let fs = require("fs"); -let path = require("path"); +const mix = require('laravel-mix'); +let fs = require('fs'); +let path = require('path'); const sassGlobImporter = require('node-sass-glob-importer'); /** @@ -15,11 +15,11 @@ const sassGlobImporter = require('node-sass-glob-importer'); /** * Setup browser sync (comment out if you don't want it) - * + * * Proxy must be the same as .env WP_HOME. (.test is the default domain for valet). */ mix.browserSync({ - proxy: "http://project-name.test", + proxy: 'http://project-name.test', }); /** @@ -30,54 +30,54 @@ mix.disableNotifications(); /** * setup general build/output folder */ -mix.setPublicPath("./public"); +mix.setPublicPath('./public'); /** * Setup main scss file to compile. */ -mix.sass("resources/styles/main.scss", "styles", { +mix.sass('resources/scss/main.scss', 'css', { sassOptions: { importer: sassGlobImporter(), logger: { debug(message, options) { - var log = "Debugging (sass @debug) ::: \n\n"; + var log = 'Debugging (sass @debug) ::: \n\n'; if (options.span) { const span = options.span; - log += `${message} at\n\n` + - `${span.url}:${span.start.line} `; + log += + `${message} at\n\n` + `${span.url}:${span.start.line} `; } else { log += `${message} at\n\n` + options.stack; } - log += "\n\n::::::::::::::::\n\n" + log += '\n\n::::::::::::::::\n\n'; console.log(log); }, warn(message, options) { - var log = "Debugging (sass @warn) ::: \n\n"; + var log = 'Debugging (sass @warn) ::: \n\n'; if (options.span) { const span = options.span; - log += `${message} at\n\n` + - `${span.url}:${span.start.line} `; + log += + `${message} at\n\n` + `${span.url}:${span.start.line} `; } else { log += `${message} at\n\n` + options.stack; } - log += "\n\n::::::::::::::::\n\n" + log += '\n\n::::::::::::::::\n\n'; console.log(log); - } + }, }, - } + }, }) - .sass("resources/styles/critical.scss", "styles") + .sass('resources/scss/critical.scss', 'css') .options({ processCssUrls: false, autoprefixer: { options: { grid: true, }, - } + }, }); /** @@ -86,41 +86,42 @@ mix.sass("resources/styles/main.scss", "styles", { */ mix.webpackConfig({ externals: { - jquery: "jQuery", + jquery: 'jQuery', }, }); mix.autoload({ - jquery: ["$", "window.jQuery"], + jquery: ['$', 'window.jQuery'], }); /** * Setup JS file to compile */ -mix.js("resources/scripts/main.js", "scripts"); -mix.js("resources/scripts/templates/front-page.js", "scripts"); - +mix.js('resources/js/main.js', 'js'); +mix.js('resources/js/templates/front-page.js', 'js'); -mix.copyDirectory("resources/images", "public/images") - .copyDirectory("resources/fonts", "public/fonts"); +mix.copyDirectory('resources/images', 'public/images').copyDirectory( + 'resources/fonts', + 'public/fonts' +); -mix.sourceMaps(true, "source-map").version(); +mix.sourceMaps(true, 'source-map').version(); mix.after(() => { let manifest = JSON.parse( - fs.readFileSync("./public/mix-manifest.json").toString() + fs.readFileSync('./public/mix-manifest.json').toString() ); let manifest2 = {}; for (let path of Object.keys(manifest)) { - let newPath = path.replace(/^\//, ""); - manifest2[newPath] = manifest[path].replace(/^\//, ""); + let newPath = path.replace(/^\//, ''); + manifest2[newPath] = manifest[path].replace(/^\//, ''); } fs.writeFileSync( - "./public/mix-manifest.json", + './public/mix-manifest.json', JSON.stringify(manifest2, null, 2) ); }); From 6304b947660e624db3955005160eb3633ee93364 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:03:02 +0000 Subject: [PATCH 02/19] chore: update editorconfig and gitignore files. --- .editorconfig | 16 ++-------------- .gitignore | 3 +-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.editorconfig b/.editorconfig index daa51f26a7..fc025ad453 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,22 +4,10 @@ root = true charset = utf-8 end_of_line = lf insert_final_newline = true -indent_style = space -indent_size = 2 +indent_style = tab +indent_size = 4 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 diff --git a/.gitignore b/.gitignore index a1900e3e52..e31b611426 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ /vendor /public .env -.budfiles npm-debug.log -yarn-error.log +.vscode From a0d18562ccc9027a9b0b80a43530adcd76aa51c3 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:08:23 +0000 Subject: [PATCH 03/19] refactor: change bootloader to use the `ThemeServiceProvider` --- functions.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/functions.php b/functions.php index 6ef07b3080..7489f010d7 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,7 @@ composer install.', 'sage')); } @@ -29,18 +31,11 @@ | */ -if (! function_exists('\Roots\bootloader')) { - wp_die( - __('You need to install Acorn to use this theme.', 'sage'), - '', - [ - 'link_url' => 'https://roots.io/acorn/docs/installation/', - 'link_text' => __('Acorn Docs: Installation', 'sage'), - ] - ); -} - -\Roots\bootloader()->boot(); +Application::configure() + ->withProviders([ + App\Providers\ThemeServiceProvider::class, + ]) + ->boot(); /* |-------------------------------------------------------------------------- @@ -60,7 +55,7 @@ function ($file) { if (! locate_template($file = "app/{$file}.php", true, true)) { wp_die( - /* translators: %s is replaced with the relative file path */ + /* translators: %s is replaced with the relative file path */ sprintf(__('Error locating %s for inclusion.', 'sage'), $file) ); } From 860d2145c3be9fd3487a0c0ddc9df0e24c06f341 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:14:01 +0000 Subject: [PATCH 04/19] =?UTF-8?q?refactor:=20=F0=9F=8E=A8=20Move=20default?= =?UTF-8?q?=20theme=20markup=20to=20the=20app=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 21 ++---------- resources/views/layouts/app.blade.php | 47 +++++++++++++++++++-------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/index.php b/index.php index 2738f4a997..edc07f1a98 100644 --- a/index.php +++ b/index.php @@ -1,20 +1,3 @@ - -> - - - - - +> - - - -
- render(); ?> -
- - - - - +echo view(app('sage.view'), app('sage.data'))->render(); diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 3f7d3024f7..ffcda1312e 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,17 +1,38 @@ - - {{ __('Skip to content') }} - + + -@include('sections.header') + + + + @php(do_action('get_header')) + @php(wp_head()) + -
- @yield('content') -
+ + @php(wp_body_open()) - @hasSection('sidebar') - - @endif +
+ + {{ __('Skip to content', 'sage') }} + -@include('sections.footer') + @include('sections.header') + +
+ @yield('content') +
+ + @hasSection('sidebar') + + @endif + + @include('sections.footer') +
+ + @php(do_action('get_footer')) + @php(wp_footer()) + + + From 008d8f1fdd3089b706e7f7b9b13d3f0fabbecaec Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:16:12 +0000 Subject: [PATCH 05/19] remove: unnecessary components/partials. --- app/View/Components/Alert.php | 57 --------------------- resources/views/partials/comments.blade.php | 39 -------------- 2 files changed, 96 deletions(-) delete mode 100644 app/View/Components/Alert.php delete mode 100644 resources/views/partials/comments.blade.php diff --git a/app/View/Components/Alert.php b/app/View/Components/Alert.php deleted file mode 100644 index fa860df66b..0000000000 --- a/app/View/Components/Alert.php +++ /dev/null @@ -1,57 +0,0 @@ - 'text-indigo-50 bg-indigo-400', - 'success' => 'text-green-50 bg-green-400', - 'caution' => 'text-yellow-50 bg-yellow-400', - 'warning' => 'text-red-50 bg-red-400', - ]; - - /** - * Create the component instance. - * - * @param string $type - * @param string $message - * @return void - */ - public function __construct($type = 'default', $message = null) - { - $this->type = $this->types[$type] ?? $this->types['default']; - $this->message = $message; - } - - /** - * Get the view / contents that represent the component. - * - * @return \Illuminate\View\View|string - */ - public function render() - { - return $this->view('components.alert'); - } -} diff --git a/resources/views/partials/comments.blade.php b/resources/views/partials/comments.blade.php deleted file mode 100644 index 84c228f8eb..0000000000 --- a/resources/views/partials/comments.blade.php +++ /dev/null @@ -1,39 +0,0 @@ -@if (! post_password_required()) -
- @if (have_comments()) -

- {!! /* translators: %1$s is replaced with the number of comments and %2$s with the post title */ sprintf(_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() . '') !!} -

- -
    - {!! wp_list_comments(['style' => 'ol', 'short_ping' => true]) !!} -
- - @if (get_comment_pages_count() > 1 && get_option('page_comments')) - - @endif - @endif - - @if (! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments')) - - {!! __('Comments are closed.', 'sage') !!} - - @endif - - @php(comment_form()) -
-@endif From cb07ec841f0b5832078d4f93d8214068efb6b9c2 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:18:05 +0000 Subject: [PATCH 06/19] chore: remove unnecessary stuff from jsconfig and update Roots name in Licence --- LICENSE.md | 2 +- jsconfig.json | 32 +++----------------------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 1b5cd27da6..9e47289f33 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) Roots Software Foundation LLC +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 diff --git a/jsconfig.json b/jsconfig.json index 0236be1476..b0b52c46da 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,32 +1,6 @@ { - "extends": "@roots/sage/config/jsconfig.json", - "compilerOptions": { - "baseUrl": "resources", - "paths": { - "@fonts/*": [ - "fonts/*" - ], - "@images/*": [ - "images/*" - ], - "@scripts/*": [ - "scripts/*" - ], - "@styles/*": [ - "styles/*" - ] - }, - "types": [ - "@roots/sage" - ] - }, "typeAcquisition": { - "include": [ - "jquery" - ] + "include": ["jquery"] }, - "exclude": [ - "node_modules", - "public" - ] -} \ No newline at end of file + "exclude": ["node_modules", "public"] +} From e26ad932080f9638b9db1f028cc8154ad4335e02 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:21:07 +0000 Subject: [PATCH 07/19] fix: check `wp_link_pages` pagination before rendering to prevent empty footer element --- app/View/Composers/Post.php | 17 ++++++++++- .../views/partials/content-page.blade.php | 6 +++- .../views/partials/content-single.blade.php | 30 +++++++++++-------- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/app/View/Composers/Post.php b/app/View/Composers/Post.php index 0d3987918b..3366b0d439 100644 --- a/app/View/Composers/Post.php +++ b/app/View/Composers/Post.php @@ -26,11 +26,12 @@ public function override() { return [ 'title' => $this->title(), + 'pagination' => $this->pagination(), ]; } /** - * Returns the post title. + * Retrieve the post title. * * @return string */ @@ -66,4 +67,18 @@ public function title() return get_the_title(); } + + /** + * Retrieve the pagination links. + * + * @return string + */ + public function pagination() + { + return wp_link_pages([ + 'echo' => 0, + 'before' => '

'.__('Pages:', 'sage'), + 'after' => '

', + ]); + } } diff --git a/resources/views/partials/content-page.blade.php b/resources/views/partials/content-page.blade.php index 5d4d20430d..904eb0c601 100644 --- a/resources/views/partials/content-page.blade.php +++ b/resources/views/partials/content-page.blade.php @@ -1,3 +1,7 @@ @php(the_content()) -{!! wp_link_pages(['echo' => 0, 'before' => '']) !!} +@if ($pagination) + +@endif diff --git a/resources/views/partials/content-single.blade.php b/resources/views/partials/content-single.blade.php index 76cce86aba..36d048e755 100644 --- a/resources/views/partials/content-single.blade.php +++ b/resources/views/partials/content-single.blade.php @@ -1,19 +1,23 @@
-
-

- {!! $title !!} -

+
+

+ {!! $title !!} +

- @include('partials.entry-meta') -
+ @include('partials.entry-meta') +
-
- @php(the_content()) -
+
+ @php(the_content()) +
-
- {!! wp_link_pages(['echo' => 0, 'before' => '']) !!} -
+ @if ($pagination) +
+ +
+ @endif - @php(comments_template()) + @php(comments_template())
From d2daf74860a9b0908a7c85600e63f21383ce56b8 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:23:21 +0000 Subject: [PATCH 08/19] docs: remove bundles description from the comment since we removed bundles during initial development. --- config/assets.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/assets.php b/config/assets.php index 80b55b9dda..73634f0455 100644 --- a/config/assets.php +++ b/config/assets.php @@ -26,8 +26,6 @@ | | assets: key-value pairs to match assets to their revved counterparts | - | bundles: a series of entrypoints for loading bundles - | */ 'manifests' => [ From ca0548d0a0c11ba3769052b781e73f8b318798bd Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:26:05 +0000 Subject: [PATCH 09/19] chore: update theme attributes in style.css and bump version, and bump php version. --- style.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/style.css b/style.css index 9522093e86..650d173ccc 100644 --- a/style.css +++ b/style.css @@ -1,13 +1,13 @@ /* -Theme Name: Sage 10 Theme -Theme URI: https://roots.io/sage/ +Theme Name: Sage Starter Theme +Theme URI: https://github.com/yCodeTech/sage10-laravelmix Description: Sage is a WordPress starter theme. Adapted and edited by @yCodeTech for usage with Laravel Mix. -Version: 10.5.1 +Version: 10.8.2 Author: Roots Author URI: https://roots.io/ Text Domain: sage License: MIT License License URI: https://opensource.org/licenses/MIT -Requires PHP: 7.4 +Requires PHP: 8.2 Requires at least: 5.9 */ From 2ee3b0bd98629204b94fe0a3233bc850cf57a02d Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:32:48 +0000 Subject: [PATCH 10/19] build: remove various irrelevant properties, dependency, and make sure it's a private package. --- package.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 2037e9405c..aa3f287bb2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "mix", - "version": "1.0.0", - "description": "", + "private": true, "main": "resources/scripts/main.js", "scripts": { "dev": "npm run development", @@ -13,8 +12,6 @@ "production": "mix --production", "watch-prod": "mix --production -- --watch" }, - "author": "", - "license": "ISC", "devDependencies": { "browser-sync": "^2.29.3", "browser-sync-webpack-plugin": "^2.3.0", @@ -26,11 +23,10 @@ "node-sass-glob-importer": "^5.3.3", "resolve-url-loader": "^5.0.0", "sass": "^1.83.4", - "sass-loader": "^16.0.4", - "@roots/sage": "6.24.0" + "sass-loader": "^16.0.4" }, "dependencies": { "postcss-css-variables": "^0.19.0", "webpack": "^5.97.1" } -} \ No newline at end of file +} From 1668624af3deb2bb51fbddf522eb198892f44273 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:34:22 +0000 Subject: [PATCH 11/19] style: auto formatting --- README.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index aac0ee0289..000a52023e 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,13 @@ ## Overview -Sage is a WordPress starter theme with block editor support. +Sage is a hybrid WordPress starter theme with block editor support. -- Harness the power of [Laravel](https://laravel.com) and its available packages thanks to [Acorn](https://github.com/roots/acorn) -- Clean, efficient theme templating utilizing [Laravel Blade](https://laravel.com/docs/master/blade) -- Modern frontend development workflow powered by ~~[Bud](https://bud.js.org/)~~ [Laravel Mix](https://laravel-mix.com/) -- Out of the box support for ~~[Tailwind CSS](https://tailwindcss.com/)~~ [SASS](https://sass-lang.com/) -- Out of the box support for [log1x/sage-directives](https://github.com/log1x/sage-directives) +- Clean, efficient theme templating utilizing [Laravel Blade](https://laravel.com/docs/master/blade) +- Harness the power of [Laravel](https://laravel.com) and its available packages thanks to [Acorn](https://github.com/roots/acorn) +- Modern frontend development workflow powered by ~~[Bud](https://bud.js.org/)~~ [Laravel Mix](https://laravel-mix.com/) +- Out of the box support for ~~[Tailwind CSS](https://tailwindcss.com/)~~ [SASS](https://sass-lang.com/) +- Out of the box support for [log1x/sage-directives](https://github.com/log1x/sage-directives) ## Getting Started @@ -45,21 +45,21 @@ This Laravel Mix adaptation of Sage 10 is for Bedrock installs. See the [Bedrock 1. Once Bedrock is installed, in the root directory, install [roots/acorn](https://github.com/roots/acorn) with `composer require roots/acorn`. Then add the following into the _scripts_ section of the _composer.json_ - ```json - "post-autoload-dump": [ - "Roots\\Acorn\\ComposerScripts::postAutoloadDump" - ] - ``` + ```json + "post-autoload-dump": [ + "Roots\\Acorn\\ComposerScripts::postAutoloadDump" + ] + ``` 2. In the _themes_ directory either clone this repository or download the zip file and unzip it into the directory. - - If cloning, you can specify the sage theme directory name in the git command, otherwise it will be the same name as this repo. Example: + - If cloning, you can specify the sage theme directory name in the git command, otherwise it will be the same name as this repo. Example: - ```bash - git clone git@github.com:yCodeTech/sage10-laravelmix.git sage-theme - ``` + ```bash + git clone git@github.com:yCodeTech/sage10-laravelmix.git sage-theme + ``` - (Note: the theme name in WP will be _Sage 10 Theme_, unless it's changed in the style.css file.) + (Note: the theme name in WP will be _Sage 10 Theme_, unless it's changed in the style.css file.) 3. Do a `composer install` and a `npm install` in the new sage theme directory. 4. Activate the theme in wp-admin and start coding locally with Laravel Mix. @@ -72,16 +72,16 @@ This Laravel Mix adaptation of Sage 10 is for Bedrock installs. See the [Bedrock ## Stay Connected -- Join us on Discord by [sponsoring us on GitHub](https://github.com/sponsors/roots) -- Participate on [Roots Discourse](https://discourse.roots.io/) -- Follow [@rootswp on Twitter](https://twitter.com/rootswp) -- Read the [Roots Blog](https://roots.io/blog/) -- Subscribe to the [Roots Newsletter](https://roots.io/newsletter/) +- Join us on Discord by [sponsoring us on GitHub](https://github.com/sponsors/roots) +- Participate on [Roots Discourse](https://discourse.roots.io/) +- Follow [@rootswp on Twitter](https://twitter.com/rootswp) +- Read the [Roots Blog](https://roots.io/blog/) +- Subscribe to the [Roots Newsletter](https://roots.io/newsletter/) ## Sponsors Sage is an open source project and completely free to use. If you've benefited from our projects and would like to support our future endeavors, please consider [sponsoring Roots](https://github.com/sponsors/roots).
-KM Digital Carrot WordPress.com Pantheon Worksite Safety Copia Digital Genero 40Q + KM Digital Carrot WordPress.com Worksite Safety Copia Digital Freave 40Q
From a95985fab1fcd6cf940880f7e8e0d667d5934878 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Thu, 16 Jan 2025 22:35:37 +0000 Subject: [PATCH 12/19] build: remove declaration of providers and require PHP 8.2 and above --- composer.json | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 9c70e374d5..fed194aafc 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ } }, "require": { - "php": "^8.0", + "php": ">=8.2", "composer/installers": "^2.3", "log1x/sage-directives": "^2.0" }, @@ -56,17 +56,5 @@ } }, "minimum-stability": "dev", - "prefer-stable": true, - "scripts": { - "lint": [ - "phpcs --extensions=php --standard=PSR12 app" - ] - }, - "extra": { - "acorn": { - "providers": [ - "App\\Providers\\ThemeServiceProvider" - ] - } - } + "prefer-stable": true } From 8bb6952a2e82195045482d3509815f4295a8ef73 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sun, 26 Jan 2025 16:27:38 +0000 Subject: [PATCH 13/19] remove: soil features --- app/setup.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/setup.php b/app/setup.php index 48c14b8158..bb161de215 100644 --- a/app/setup.php +++ b/app/setup.php @@ -52,21 +52,6 @@ function () { add_action( 'after_setup_theme', function () { - /** - * Enable features from the Soil plugin if activated. - * - * @link https://roots.io/plugins/soil/ - */ - add_theme_support( - 'soil', - [ - 'clean-up', - 'nav-walker', - 'nice-search', - 'relative-urls', - ] - ); - /** * Disable full-site editing support. * From 8a9c7c22bb02db923387d49281bb0a17c7aefe8d Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sun, 26 Jan 2025 17:30:40 +0000 Subject: [PATCH 14/19] revert: commit a0d1856 that changed the bootloader. The `config()` method of `Application` doesn't exist in the current Acorn (v4.3.1) and this new bootloader code is not apart of Sage v10.8.2, but for an upcoming version of Sage. Fixes PHP error: "Fatal error: Uncaught BadMethodCallException: Method Roots\Acorn\Application::configure does not exist." by reverting the code changed in commit a0d1856. --- functions.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/functions.php b/functions.php index 7489f010d7..ecdfcc3baa 100644 --- a/functions.php +++ b/functions.php @@ -1,7 +1,5 @@ withProviders([ - App\Providers\ThemeServiceProvider::class, - ]) - ->boot(); +if (! function_exists('\Roots\bootloader')) { + wp_die( + __('You need to install Acorn to use this theme.', 'sage'), + '', + [ + 'link_url' => 'https://roots.io/acorn/docs/installation/', + 'link_text' => __('Acorn Docs: Installation', 'sage'), + ] + ); +} + +\Roots\bootloader()->boot(); /* |-------------------------------------------------------------------------- From 4513dbf3a6afc9a8fbfcfe84299515b53855e9ae Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sun, 26 Jan 2025 18:12:30 +0000 Subject: [PATCH 15/19] revert: commit a95985f partially. The commit a95985f removed the declaration of the `ThemeServiceProvider`. This is not needed for an upcoming version of Sage, but is needed for Sage 10.8.2. Fixes PHP/Symfony error: "Target class [sage.view] does not exist." by re-adding the declaration of `ThemeServiceProvider` in composer.json. Related to commit 8a9c7c2. --- composer.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fed194aafc..396ae3b53e 100644 --- a/composer.json +++ b/composer.json @@ -56,5 +56,12 @@ } }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "extra": { + "acorn": { + "providers": [ + "App\\Providers\\ThemeServiceProvider" + ] + } + } } From d832f2a68c1bf6d6f234af6c2fe19cb320677e94 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sun, 26 Jan 2025 20:48:23 +0000 Subject: [PATCH 16/19] remove: `node-sass-glob-importer` unmaintained dependency. --- package.json | 1 - resources/scss/main.scss | 15 +++------------ webpack.mix.js | 37 +------------------------------------ 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index aa3f287bb2..becc921592 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "jquery": "^3.7.1", "laravel-mix": "^6.0.49", "node-sass": "^9.0.0", - "node-sass-glob-importer": "^5.3.3", "resolve-url-loader": "^5.0.0", "sass": "^1.83.4", "sass-loader": "^16.0.4" diff --git a/resources/scss/main.scss b/resources/scss/main.scss index 0917f45cbd..7abc9f46f9 100644 --- a/resources/scss/main.scss +++ b/resources/scss/main.scss @@ -13,21 +13,12 @@ // Import theme styles \\ @import "common/global"; -// Import everything in directory \\ - -// Uses node-sass-glob-importer - -// Only do this when the load order -// of the files doesn't matter. - -// Components don't rely on other components. -@import "components/**/*"; - @import "layouts/header"; @import "layouts/sidebar"; @import "layouts/footer"; @import "layouts/posts"; @import "layouts/tinymce"; -// Import all pages scss files, as they don't rely on each other \\ -@import "pages/**/*"; +// Import all pages scss files \\ +@import "pages/landing-page"; +@import "pages/pages"; diff --git a/webpack.mix.js b/webpack.mix.js index f817e16449..df568881e6 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -1,7 +1,6 @@ const mix = require('laravel-mix'); let fs = require('fs'); let path = require('path'); -const sassGlobImporter = require('node-sass-glob-importer'); /** * @@ -35,41 +34,7 @@ mix.setPublicPath('./public'); /** * Setup main scss file to compile. */ -mix.sass('resources/scss/main.scss', 'css', { - sassOptions: { - importer: sassGlobImporter(), - logger: { - debug(message, options) { - var log = 'Debugging (sass @debug) ::: \n\n'; - - if (options.span) { - const span = options.span; - log += - `${message} at\n\n` + `${span.url}:${span.start.line} `; - } else { - log += `${message} at\n\n` + options.stack; - } - log += '\n\n::::::::::::::::\n\n'; - - console.log(log); - }, - warn(message, options) { - var log = 'Debugging (sass @warn) ::: \n\n'; - - if (options.span) { - const span = options.span; - log += - `${message} at\n\n` + `${span.url}:${span.start.line} `; - } else { - log += `${message} at\n\n` + options.stack; - } - log += '\n\n::::::::::::::::\n\n'; - - console.log(log); - }, - }, - }, -}) +mix.sass('resources/scss/main.scss', 'css') .sass('resources/scss/critical.scss', 'css') .options({ processCssUrls: false, From b756e0788cbcd2e9a5964fa90964908b7f29d058 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sun, 26 Jan 2025 20:54:39 +0000 Subject: [PATCH 17/19] fix: the renamed css and js files when including them in the site. Related to commit 81655d2. --- app/setup.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/setup.php b/app/setup.php index bb161de215..f33c7b87bf 100644 --- a/app/setup.php +++ b/app/setup.php @@ -14,11 +14,11 @@ add_action( 'wp_enqueue_scripts', function () { - wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null); - wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true); + wp_enqueue_style('sage/main.css', asset_path('css/main.css'), false, null); + wp_enqueue_script('sage/main.js', asset_path('js/main.js'), ['jquery'], null, true); if (is_front_page()) { - wp_enqueue_script('sage/front-page.js', asset_path('scripts/front-page.js'), ['jquery'], null, true); + wp_enqueue_script('sage/front-page.js', asset_path('js/front-page.js'), ['jquery'], null, true); } // Move Wordpress jQuery to footer @@ -35,7 +35,7 @@ function () { add_action( 'wp_head', function () { - $critical = @realpath(asset_path('styles/critical.css')); + $critical = @realpath(asset_path('css/critical.css')); if (file_exists($critical)) { echo ''; } @@ -128,7 +128,7 @@ function () { * Use main stylesheet for visual editor * @see resources/assets/styles/layouts/_tinymce.scss */ - add_editor_style(asset_path('styles/main.css')); + add_editor_style(asset_path('css/main.css')); }, 20 ); From 3be9ff5590f75141eeaff81971177a0ae50aa244 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sun, 26 Jan 2025 21:33:33 +0000 Subject: [PATCH 18/19] feat: add comments view and composer --- app/View/Composers/Comments.php | 119 ++++++++++++++++++++ resources/views/partials/comments.blade.php | 39 +++++++ 2 files changed, 158 insertions(+) create mode 100644 app/View/Composers/Comments.php create mode 100644 resources/views/partials/comments.blade.php diff --git a/app/View/Composers/Comments.php b/app/View/Composers/Comments.php new file mode 100644 index 0000000000..748d3a3f8d --- /dev/null +++ b/app/View/Composers/Comments.php @@ -0,0 +1,119 @@ + $this->title(), + 'responses' => $this->responses(), + 'previous' => $this->previous(), + 'next' => $this->next(), + 'paginated' => $this->paginated(), + 'closed' => $this->closed(), + ]; + } + + /** + * The comment title. + * + * @return string + */ + public function title() + { + 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. + * + * @return string + */ + public function responses() + { + if (! have_comments()) { + return; + } + + return wp_list_comments([ + 'style' => 'ol', + 'short_ping' => true, + 'echo' => false, + ]); + } + + /** + * The previous comments link. + * + * @return string + */ + public function previous() + { + if (! get_previous_comments_link()) { + return; + } + + return get_previous_comments_link( + __('← Older comments', 'sage') + ); + } + + /** + * The next comments link. + * + * @return string + */ + public function next() + { + if (! get_next_comments_link()) { + return; + } + + return get_next_comments_link( + __('Newer comments →', 'sage') + ); + } + + /** + * Determine if the comments are paginated. + * + * @return bool + */ + public function paginated() + { + return get_comment_pages_count() > 1 && get_option('page_comments'); + } + + /** + * Determine if the comments are closed. + * + * @return bool + */ + public function closed() + { + return ! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments'); + } +} diff --git a/resources/views/partials/comments.blade.php b/resources/views/partials/comments.blade.php new file mode 100644 index 0000000000..865f67bd69 --- /dev/null +++ b/resources/views/partials/comments.blade.php @@ -0,0 +1,39 @@ +@if (!post_password_required()) +
+ @if ($responses) +

+ {!! $title !!} +

+ +
    + {!! $responses !!} +
+ + @if ($paginated) + + @endif + @endif + + @if ($closed) + + {!! __('Comments are closed.', 'sage') !!} + + @endif + + @php(comment_form()) +
+@endif From 7836aa16fa5236ac274df166795278878642f995 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Mon, 27 Jan 2025 21:41:24 +0000 Subject: [PATCH 19/19] docs: update badges and some text. --- README.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 000a52023e..044cd97c39 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,13 @@

- - Packagist Installs + + PHP version - - - Build Status - - - - Follow Roots + + PHP version

@@ -29,7 +26,7 @@ ## Overview -Sage is a hybrid WordPress starter theme with block editor support. +Sage is a hybrid WordPress starter theme with: - Clean, efficient theme templating utilizing [Laravel Blade](https://laravel.com/docs/master/blade) - Harness the power of [Laravel](https://laravel.com) and its available packages thanks to [Acorn](https://github.com/roots/acorn)