Skip to content

Commit 5188102

Browse files
committed
Use Laravel Mix & SASS; and D, M, A
- Deleted (D) bud.config.js, tailwind.config.js, theme.json, yarn.lock, editor.css, editor.js, app.css, app.js. - Modified (M): - README - functions.php to use an array variable for the required files (in the Register Sage Theme Files section), for easier reading. - jsconfig.json to include jQuery type acquisition. - package.json to remove Roots Bud and Tailwind CSS packages, and added the required packages for Laravel Mix to function. - style.css to change name of the theme, add my links, and various other details. - filters.php to add default Lorum Ipsum content to new posts. - setup.php to remove Roots Bundle nonsense and add back the Sage 9 enqueue scripts and styles, plus critical css. - Added (A): - The styles directory structure from Sage 9 (common, components, layouts), and various SCSS files. - webpack.mix.js to add Laravel Mix settings. - admin.php to output a new footer message in the admin. - helpers.php to add helper functions like asset_path to get the path of the asset. - The config directory from Sage 9, and the assets.php to change the manifest name to mix-manifest (otherwise errors occur) and view.php to add SVG and SVG_ICONS namespaces to the @include directive. - main.js without any routes rubbish. - Scripts templates directory for the new front-page.js and template-contact.js - svg and icons directory in the images directory. - main.scss to add back the Sage 9 SCSS module includes.
1 parent cc94b1b commit 5188102

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1303
-10496
lines changed

README.md

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,57 @@
1818
</a>
1919
</p>
2020

21-
<p align="center">Advanced WordPress starter theme with Tailwind CSS and Laravel Blade</p>
21+
<p align="center">Advanced WordPress starter theme with <del>Tailwind CSS</del> SASS/SCSS and Laravel Blade</p>
22+
<p align="center">Adapted and edited by <a href="https://github.com/yCodeTech" target="_blank">@yCodeTech</a> for usage with <a href="https://laravel-mix.com/" target="_blank">Laravel Mix</a>.</p>
23+
24+
---
2225

2326
<p align="center">
2427
<a href="https://roots.io/sage/">Website</a> &nbsp;&nbsp; <a href="https://roots.io/sage/docs/installation/">Documentation</a> &nbsp;&nbsp; <a href="https://github.com/roots/sage/releases">Releases</a> &nbsp;&nbsp; <a href="https://discourse.roots.io/">Community</a>
2528
</p>
2629

27-
## Sponsors
28-
29-
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).
30-
31-
<div align="center">
32-
<a href="https://k-m.com/"><img src="https://cdn.roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="120" height="90"></a> <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://pantheon.io/"><img src="https://cdn.roots.io/app/uploads/pantheon.svg" alt="Pantheon" width="120" height="90"></a> <a href="https://worksitesafety.ca/careers/"><img src="https://cdn.roots.io/app/uploads/worksite-safety.svg" alt="Worksite Safety" width="120" height="90"></a> <a href="https://www.copiadigital.com/"><img src="https://cdn.roots.io/app/uploads/copia-digital.svg" alt="Copia Digital" width="120" height="90"></a> <a href="https://generodigital.com/"><img src="https://cdn.roots.io/app/uploads/genero.svg" alt="Genero" 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>
33-
</div>
34-
3530
## Overview
3631

3732
Sage is a WordPress starter theme with block editor support.
3833

3934
- Harness the power of [Laravel](https://laravel.com) and its available packages thanks to [Acorn](https://github.com/roots/acorn)
4035
- Clean, efficient theme templating utilizing [Laravel Blade](https://laravel.com/docs/master/blade)
41-
- Modern frontend development workflow powered by [Bud](https://bud.js.org/)
42-
- Out of the box support for [Tailwind CSS](https://tailwindcss.com/)
36+
- Modern frontend development workflow powered by ~~[Bud](https://bud.js.org/)~~ [Laravel Mix](https://laravel-mix.com/)
37+
- Out of the box support for ~~[Tailwind CSS](https://tailwindcss.com/)~~ [SASS](https://sass-lang.com/)
38+
- Out of the box support for [log1x/sage-directives](https://github.com/log1x/sage-directives)
4339

4440
## Getting Started
4541

46-
See the [Sage installation documentation](https://roots.io/sage/docs/installation/).
42+
~~See the [Sage installation documentation](https://roots.io/sage/docs/installation/).~~
43+
44+
This Laravel Mix adaptation of Sage 10 is for Bedrock installs. See the [Bedrock installation documentation](https://roots.io/bedrock/docs/installation/). The instructions below assumes you have knowledge of the Laravel Mix settings, and most other non-documented setting up steps.
45+
46+
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_
47+
48+
```json
49+
"post-autoload-dump": [
50+
"Roots\\Acorn\\ComposerScripts::postAutoloadDump"
51+
]
52+
```
53+
54+
2. In the _themes_ directory either clone this repository or download the zip file and unzip it into the directory.
55+
56+
- 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:
57+
58+
```bash
59+
git clone git@github.com:yCodeTech/sage10-laravelmix.git sage-theme
60+
```
61+
62+
(Note: the theme name in WP will be _Sage 10 Theme_, unless it's changed in the style.css file.)
63+
64+
3. Do a `composer install` and a `npm install` in the new sage theme directory.
65+
4. Activate the theme in wp-admin and start coding locally with Laravel Mix.
66+
67+
## Laravel Mix Commands
68+
69+
`npx mix watch` - Compile assets, watches the files for any changes, and start Browsersync session.
70+
71+
`npx mix --production` - Compile assets for production.
4772
4873
## Stay Connected
4974
@@ -52,3 +77,11 @@ See the [Sage installation documentation](https://roots.io/sage/docs/installatio
5277
- Follow [@rootswp on Twitter](https://twitter.com/rootswp)
5378
- Read the [Roots Blog](https://roots.io/blog/)
5479
- Subscribe to the [Roots Newsletter](https://roots.io/newsletter/)
80+
81+
## Sponsors
82+
83+
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).
84+
85+
<div align="center">
86+
<a href="https://k-m.com/"><img src="https://cdn.roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="120" height="90"></a> <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://pantheon.io/"><img src="https://cdn.roots.io/app/uploads/pantheon.svg" alt="Pantheon" width="120" height="90"></a> <a href="https://worksitesafety.ca/careers/"><img src="https://cdn.roots.io/app/uploads/worksite-safety.svg" alt="Worksite Safety" width="120" height="90"></a> <a href="https://www.copiadigital.com/"><img src="https://cdn.roots.io/app/uploads/copia-digital.svg" alt="Copia Digital" width="120" height="90"></a> <a href="https://generodigital.com/"><img src="https://cdn.roots.io/app/uploads/genero.svg" alt="Genero" 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>
87+
</div>

app/Providers/ThemeServiceProvider.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66

77
class ThemeServiceProvider extends SageServiceProvider
88
{
9-
/**
10-
* Register any application services.
11-
*
12-
* @return void
13-
*/
14-
public function register()
15-
{
16-
parent::register();
17-
}
9+
/**
10+
* Register any application services.
11+
*
12+
* @return void
13+
*/
14+
public function register() {
15+
parent::register();
16+
}
1817

19-
/**
20-
* Bootstrap any application services.
21-
*
22-
* @return void
23-
*/
24-
public function boot()
25-
{
26-
parent::boot();
27-
}
18+
/**
19+
* Bootstrap any application services.
20+
*
21+
* @return void
22+
*/
23+
public function boot() {
24+
parent::boot();
25+
}
2826
}

app/admin.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App;
4+
5+
/* Alter admin footer */
6+
add_filter(
7+
'admin_footer_text',
8+
function () {
9+
echo '<span>Powered by <a href="http://www.wordpress.org" target="_blank">WordPress</a> | Bedrock and Sage 10 theme by <a href="https://roots.io/" target="_blank">Roots</a>, adapted and edited by <a href="https://github.com/yCodeTech" target="_blank">@yCodeTech</a></span> for usage with <a href="https://laravel-mix.com/" target="_blank">Laravel Mix</a>.';
10+
}
11+
);

app/filters.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@
1414
add_filter('excerpt_more', function () {
1515
return sprintf(' &hellip; <a href="%s">%s</a>', get_permalink(), __('Continued', 'sage'));
1616
});
17+
18+
/**
19+
* Add default Lorum Ipsum content to new posts.
20+
* https://www.wpbeginner.com/wp-tutorials/how-to-add-default-content-in-your-wordpress-post-editor/
21+
*/
22+
add_filter('default_content', function ($content) {
23+
$content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam venenatis arcu odio, et facilisis nibh venenatis ut. Vestibulum viverra lacus vitae lacus gravida laoreet ac at purus.
24+
25+
Maecenas arcu odio, suscipit id posuere vel, consequat eu orci. Nullam dictum placerat dolor, eu eleifend lacus ullamcorper ut.";
26+
27+
return $content;
28+
});

app/helpers.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App;
4+
5+
/**
6+
* @param $asset
7+
* @return string
8+
*/
9+
function asset_path($asset) {
10+
return asset($asset)->uri();
11+
}

0 commit comments

Comments
 (0)