Skip to content

Commit

Permalink
Merge pull request #2172 from Log1x/10.0.0-dev
Browse files Browse the repository at this point in the history
Move Sage 10 to Laravel Mix
  • Loading branch information
retlehs authored May 1, 2019
2 parents eb34767 + 9117058 commit 33566ab
Show file tree
Hide file tree
Showing 56 changed files with 3,109 additions and 17,504 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

11 changes: 6 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_size = 4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Make sure all dependencies have been installed before moving on:
* [WordPress](https://wordpress.org/) >= 4.7
* [PHP](https://secure.php.net/manual/en/install.php) >= 7.1.3 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled)
* [Composer](https://getcomposer.org/download/)
* [Node.js](http://nodejs.org/) >= 6.9.x
* [Node.js](http://nodejs.org/) >= 8.0.0
* [Yarn](https://yarnpkg.com/en/docs/install)

## Theme installation
Expand Down
4 changes: 2 additions & 2 deletions app/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
add_filter('body_class', function (array $classes) {
/** Add page slug if it doesn't exist */
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
if (is_single() || is_page() && ! is_front_page()) {
if (! in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
}
}
Expand Down
25 changes: 19 additions & 6 deletions app/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@

namespace App;

use function Roots\add_actions;
use function Roots\asset;
use function Roots\config;
use function Roots\view;

/**
* Theme assets
*/
add_action('wp_enqueue_scripts', function () {
wp_enqueue_script('sage/vendor', asset('scripts/vendor.js'), ['jquery'], null, true);
wp_enqueue_script('sage/main', asset('scripts/main.js'), ['sage/vendor', 'jquery'], null, true);
wp_enqueue_script('sage/vendor', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);
wp_enqueue_script('sage/app', asset('scripts/app.js')->uri(), ['sage/vendor', 'jquery'], null, true);

wp_add_inline_script('sage/vendor', asset('scripts/manifest.js')->contents(), 'before');

if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}

$styles = ['styles/main.css'];
$styles = ['styles/app.css'];

foreach ($styles as $stylesheet) {
if (($asset = asset($stylesheet)->exists())) {
if ($asset = asset($stylesheet)->exists()) {
wp_enqueue_style('sage/'.basename($stylesheet, '.css'), asset($stylesheet)->uri(), false, null);
}
}
Expand Down Expand Up @@ -75,9 +77,9 @@

/**
* Use main stylesheet for visual editor
* @see resources/assets/styles/layouts/_tinymce.scss
* @see resources/assets/styles/layouts/tinymce.scss
*/
add_editor_style(asset('styles/admin.css')->uri());
add_editor_style(asset('styles/app.css')->uri());
}, 20);

/**
Expand All @@ -101,3 +103,14 @@
'id' => 'sidebar-footer'
] + $config);
});

/**
* Remove Blade cache when theme is activated, changed, or removed.
*/
add_actions(['after_switch_theme', 'switch_theme'], function () {
return collect(glob(config('view.compiled') . '/*.php'))
->filter()
->map(function ($file) {
unlink($file);
});
});
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"roots/acorn": "dev-master"
},
"require-dev": {
"roots/sage-installer": "^1.6",
"squizlabs/php_codesniffer": "^3.3"
"squizlabs/php_codesniffer": "^3.4"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -51,9 +50,6 @@
"scripts": {
"test": [
"phpcs"
],
"post-create-project-cmd": [
"Roots\\Sage\\Installer\\ComposerScript::postCreateProject"
]
}
}
Loading

0 comments on commit 33566ab

Please sign in to comment.