Merge branch 'master' into master

This commit is contained in:
Ben Word
2018-08-21 15:30:05 -06:00
committed by GitHub
34 changed files with 8073 additions and 5850 deletions

View File

@@ -32,7 +32,7 @@ module.exports = {
]
},
"rules": {
"no-console": process.env.NODE_ENV === 'production' ? 2 : 0,
"no-console": 0,
"comma-dangle": [
"error",
{

View File

@@ -3,7 +3,6 @@ sudo: false
dist: trusty
php:
- 7.1
- 7.0
- nightly
env:

View File

@@ -1,4 +1,12 @@
### HEAD
### 9.0.1: April 30th, 2018
* Update to Bootstrap 4.1.1 ([#2065](https://github.com/roots/sage/pull/2065))
* Auto-detect `proxyUrl` scheme ([#2062](https://github.com/roots/sage/pull/2062))
* Bump to Laravel 5.6 ([#2061](https://github.com/roots/sage/pull/2061))
* Update to Bootstrap 4.1.0 ([#2056](https://github.com/roots/sage/pull/2056))
* Change inline `@php` directive to full form ([#2042](https://github.com/roots/sage/pull/2042))
* PHP 7.1.3+ is now required ([#2037](https://github.com/roots/sage/pull/2037))
### 9.0.0: February 7th, 2018
* Update to Bootstrap 4 ([#2015](https://github.com/roots/sage/pull/2015))
* Allow `no-console` development ([#2008](https://github.com/roots/sage/pull/2008))
* Move variables and Bootstrap lines to autoload ([#1993](https://github.com/roots/sage/pull/1993))

View File

@@ -5,18 +5,15 @@
Sage is a WordPress starter theme with a modern development workflow.
**Sage 9 is in active development and is currently in beta. The `master` branch tracks Sage 9 development. If you want a stable version, use the [latest Sage 8 release](https://github.com/roots/sage/releases/latest).**
## Features
* Sass for stylesheets
* Modern JavaScript
* [Webpack](https://webpack.github.io/) for compiling assets, optimizing images, and concatenating and minifying files
* [Browsersync](http://www.browsersync.io/) for synchronized browser testing
* [Laravel Blade](https://laravel.com/docs/5.3/blade) as a templating engine
* [Blade](https://laravel.com/docs/5.5/blade) as a templating engine
* [Controller](https://github.com/soberwp/controller) for passing data to Blade templates
* CSS framework (optional): [Bootstrap 4](https://getbootstrap.com/), [Bulma](https://bulma.io/), [Foundation](https://foundation.zurb.com/), [Tachyons](http://tachyons.io/)
* Font Awesome (optional)
See a working example at [roots-example-project.com](https://roots-example-project.com/).
@@ -25,7 +22,7 @@ See a working example at [roots-example-project.com](https://roots-example-proje
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.0 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled)
* [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
* [Yarn](https://yarnpkg.com/en/docs/install)
@@ -36,10 +33,16 @@ Install Sage using Composer from your WordPress themes directory (replace `your-
```shell
# @ app/themes/ or wp-content/themes/
$ composer create-project roots/sage your-theme-name
```
To install the latest development version of Sage, add `dev-master` to the end of the command:
```shell
$ composer create-project roots/sage your-theme-name dev-master
```
During theme installation you will have options to update `style.css` theme headers, select a CSS framework, add Font Awesome, and configure Browsersync.
During theme installation you will have options to update `style.css` theme headers, select a CSS framework, and configure Browsersync.
## Theme structure
@@ -87,20 +90,25 @@ Edit `app/setup.php` to enable or disable theme features, setup navigation menus
### Build commands
* `yarn run start` — Compile assets when file changes are made, start Browsersync session
* `yarn run build` — Compile and optimize the files in your assets directory
* `yarn run build:production` — Compile assets for production
* `yarn start` — Compile assets when file changes are made, start Browsersync session
* `yarn build` — Compile and optimize the files in your assets directory
* `yarn build:production` — Compile assets for production
## Documentation
* [Sage 8 documentation](https://roots.io/sage/docs/) (stable version of Sage 8, _not_ this repo)
* [Sage 9 documentation](https://github.com/roots/docs/tree/sage-9/sage) (in progress)
* [Sage documentation](https://roots.io/sage/docs/)
* [Controller documentation](https://github.com/soberwp/controller#usage)
## Contributing
Contributions are welcome from everyone. We have [contributing guidelines](https://github.com/roots/guidelines/blob/master/CONTRIBUTING.md) to help you get started.
## Gold sponsors
Help support our open-source development efforts by [contributing to Sage on OpenCollective](https://opencollective.com/sage).
<a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="200" height="150"></a> <a href="https://k-m.com/"><img src="https://roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="200" height="150"></a>
## Community
Keep track of development and community news.

View File

@@ -13,6 +13,11 @@ add_filter('body_class', function (array $classes) {
}
}
/** Add a global class to everything.
* We want it to come first, so stuff its filter does can be overridden.
*/
array_unshift($classes, 'app');
/** Add class if sidebar is active */
if (display_sidebar()) {
$classes[] = 'sidebar-primary';
@@ -67,4 +72,24 @@ add_filter('comments_template', function ($comments_template) {
$comments_template
);
return template_path(locate_template(["views/{$comments_template}", $comments_template]) ?: $comments_template);
}, 100);
/**
* Render WordPress searchform using Blade
*/
add_filter('get_search_form', function () {
return template('partials.searchform');
});
/**
* Collect data for searchform.
*/
add_filter('sage/template/app/data', function ($data) {
return $data + [
'sf_action' => esc_url(home_url('/')),
'sf_screen_reader_text' => _x('Search for:', 'label', 'sage'),
'sf_placeholder' => esc_attr_x('Search &hellip;', 'placeholder', 'sage'),
'sf_current_query' => get_search_query(),
'sf_submit_text' => esc_attr_x('Search', 'submit button', 'sage'),
];
});

View File

@@ -52,7 +52,7 @@ function config($key = null, $default = null)
*/
function template($file, $data = [])
{
if (remove_action('wp_head', 'wp_enqueue_scripts', 1)) {
if (!is_admin() && remove_action('wp_head', 'wp_enqueue_scripts', 1)) {
wp_enqueue_scripts();
}
@@ -109,10 +109,12 @@ function filter_templates($templates)
return [
"{$path}/{$template}.blade.php",
"{$path}/{$template}.php",
];
})
->concat([
"{$template}.blade.php",
"{$template}.php",
];
});
]);
})
->filter()
->unique()

View File

@@ -13,6 +13,10 @@ use Roots\Sage\Template\BladeProvider;
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);
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}, 100);
/**

View File

@@ -32,10 +32,10 @@
}
},
"require": {
"php": ">=7",
"php": ">=7.1",
"composer/installers": "~1.0",
"illuminate/support": "~5.4",
"roots/sage-lib": "~9.0.0-beta.4",
"illuminate/support": "~5.6",
"roots/sage-lib": "~9.0.1",
"soberwp/controller": "~2.1.0"
},
"require-dev": {

803
composer.lock generated

File diff suppressed because it is too large Load Diff

10295
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "sage",
"version": "9.0.0-beta.4",
"version": "9.0.1",
"author": "Roots <team@roots.io>",
"homepage": "https://roots.io/sage/",
"private": true,
@@ -52,7 +52,7 @@
},
"scripts": {
"build": "webpack --progress --config resources/assets/build/webpack.config.js",
"build:production": "webpack --progress -p --config resources/assets/build/webpack.config.js",
"build:production": "webpack --env.production --progress --config resources/assets/build/webpack.config.js",
"build:profile": "webpack --progress --profile --json --config resources/assets/build/webpack.config.js",
"start": "webpack --hide-modules --watch --config resources/assets/build/webpack.config.js",
"rmdist": "rimraf dist",
@@ -65,7 +65,7 @@
"node": ">= 6.9.4"
},
"devDependencies": {
"autoprefixer": "~7.2.5",
"autoprefixer": "~8.2.0",
"browser-sync": "~2.23.6",
"browsersync-webpack-plugin": "^0.6.0",
"bs-html-injector": "~3.0",
@@ -75,36 +75,37 @@
"copy-globs-webpack-plugin": "^0.2.0",
"css-loader": "^0.28.9",
"cssnano": "~v4.0.0-rc.2",
"eslint": "~4.17.0",
"eslint": "~4.19.1",
"eslint-loader": "~1.9",
"eslint-plugin-import": "~2.8.0",
"eslint-plugin-import": "~2.11.0",
"extract-text-webpack-plugin": "~3.0.2",
"file-loader": "^1.1.6",
"friendly-errors-webpack-plugin": "^1.6.1",
"imagemin-mozjpeg": "~7.0.0",
"imagemin-webpack-plugin": "~2.0.0",
"imagemin-webpack-plugin": "~2.1.1",
"import-glob": "~1.5",
"node-sass": "~4.7.2",
"node-sass": "~4.8.3",
"postcss-loader": "~2.1.0",
"postcss-safe-parser": "~3.0",
"resolve-url-loader": "~2.2.1",
"resolve-url-loader": "~2.3.0",
"rimraf": "~2.6",
"sass-loader": "~6.0",
"style-loader": "^0.20.1",
"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.0.0",
"stylelint-config-standard": "~18.2.0",
"stylelint-webpack-plugin": "^0.10.1",
"uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "^0.6.2",
"webpack": "~3.10.0",
"webpack-assets-manifest": "^1.0.0",
"webpack-dev-middleware": "~2.0.4",
"webpack-hot-middleware": "~2.21.0",
"webpack-hot-middleware": "~2.22.0",
"webpack-merge": "~4.1.1",
"yargs": "~11.0.0"
},
"dependencies": {
"bootstrap": "v4.0.0",
"bootstrap": "v4.1.3",
"jquery": "^3.3.1",
"popper.js": "^1.12.9"
"popper.js": "^1.14.3"
}
}

View File

@@ -8,8 +8,8 @@ module.exports = ({ file, options }) => {
return {
parser: options.enabled.optimize ? 'postcss-safe-parser' : undefined,
plugins: {
cssnano: options.enabled.optimize ? cssnanoConfig : false,
autoprefixer: true,
cssnano: options.enabled.optimize ? cssnanoConfig : false,
},
};
};

View File

@@ -8,6 +8,7 @@ const StyleLintPlugin = require('stylelint-webpack-plugin');
const CopyGlobsPlugin = require('copy-globs-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const desire = require('./util/desire');
const config = require('./config');
const assetsFilenames = (config.enabled.cacheBusting) ? config.cacheBusting : '[name]';
@@ -89,12 +90,17 @@ let webpackConfig = {
},
},
{ loader: 'resolve-url', options: { sourceMap: config.enabled.sourceMaps } },
{ loader: 'sass', options: { sourceMap: config.enabled.sourceMaps } },
{
loader: 'sass', options: {
sourceMap: config.enabled.sourceMaps,
sourceComments: true,
},
},
],
}),
},
{
test: /\.(ttf|eot|woff2?|png|jpe?g|gif|svg|ico)$/,
test: /\.(ttf|otf|eot|woff2?|png|jpe?g|gif|svg|ico)$/,
include: config.paths.assets,
loader: 'url',
options: {
@@ -103,7 +109,7 @@ let webpackConfig = {
},
},
{
test: /\.(ttf|eot|woff2?|png|jpe?g|gif|svg|ico)$/,
test: /\.(ttf|otf|eot|woff2?|png|jpe?g|gif|svg|ico)$/,
include: /node_modules/,
loader: 'url',
options: {
@@ -208,4 +214,6 @@ if (config.enabled.watcher) {
webpackConfig = merge(webpackConfig, require('./webpack.config.watch'));
}
module.exports = webpackConfig;
module.exports = merge.smartStrategy({
'module.loaders': 'replace',
})(webpackConfig, desire(`${__dirname}/webpack.config.preset`));

View File

@@ -2,6 +2,7 @@
const { default: ImageminPlugin } = require('imagemin-webpack-plugin');
const imageminMozjpeg = require('imagemin-mozjpeg');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const config = require('./config');
@@ -11,9 +12,24 @@ module.exports = {
optipng: { optimizationLevel: 7 },
gifsicle: { optimizationLevel: 3 },
pngquant: { quality: '65-90', speed: 4 },
svgo: { removeUnknownsAndDefaults: false, cleanupIDs: false },
svgo: {
plugins: [
{ removeUnknownsAndDefaults: false },
{ cleanupIDs: false },
{ removeViewBox: false },
],
},
plugins: [imageminMozjpeg({ quality: 75 })],
disable: (config.enabled.watcher),
}),
new UglifyJsPlugin({
uglifyOptions: {
ecma: 5,
compress: {
warnings: true,
drop_console: true,
},
},
}),
],
};

View File

@@ -11,6 +11,8 @@ const target = process.env.DEVURL || config.devUrl;
*/
if (url.parse(target).protocol === 'https:') {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
config.proxyUrl = config.proxyUrl.replace('http:', 'https:');
}
module.exports = {

View File

@@ -2,5 +2,5 @@
@import "~bootstrap/scss/functions";
$theme-colors: (
primary: #27ae60
primary: #525ddc
);

View File

@@ -23,8 +23,8 @@ $sage_error = function ($message, $subtitle = '', $title = '') {
/**
* Ensure compatible version of PHP is used
*/
if (version_compare('7', phpversion(), '>=')) {
$sage_error(__('You must be using PHP 7 or greater.', 'sage'), __('Invalid PHP version', 'sage'));
if (version_compare('7.1', phpversion(), '>=')) {
$sage_error(__('You must be using PHP 7.1 or greater.', 'sage'), __('Invalid PHP version', 'sage'));
}
/**

View File

@@ -2,7 +2,7 @@
Theme Name: Sage Starter Theme
Theme URI: https://roots.io/sage/
Description: Sage is a WordPress starter theme.
Version: 9.0.0-beta.4
Version: 9.0.1
Author: Roots
Author URI: https://roots.io/
Text Domain: sage

View File

@@ -10,7 +10,7 @@
{!! get_search_form(false) !!}
@endif
@while (have_posts()) @php(the_post())
@while (have_posts()) @php the_post() @endphp
@include('partials.content-'.get_post_type())
@endwhile

View File

@@ -1,8 +1,8 @@
<!doctype html>
<html @php(language_attributes())>
<html {{ get_language_attributes() }}>
@include('partials.head')
<body @php(body_class())>
@php(do_action('get_header'))
<body @php body_class() @endphp>
@php do_action('get_header') @endphp
@include('partials.header')
<div class="wrap container" role="document">
<div class="content">
@@ -16,8 +16,8 @@
@endif
</div>
</div>
@php(do_action('get_footer'))
@php do_action('get_footer') @endphp
@include('partials.footer')
@php(wp_footer())
@php wp_footer() @endphp
</body>
</html>

View File

@@ -1,7 +1,7 @@
@extends('layouts.app')
@section('content')
@while(have_posts()) @php(the_post())
@while(have_posts()) @php the_post() @endphp
@include('partials.page-header')
@include('partials.content-page')
@endwhile

View File

@@ -18,10 +18,10 @@ if (post_password_required()) {
<nav>
<ul class="pager">
@if (get_previous_comments_link())
<li class="previous">@php(previous_comments_link(__('&larr; Older comments', 'sage')))</li>
<li class="previous">@php previous_comments_link(__('&larr; Older comments', 'sage')) @endphp</li>
@endif
@if (get_next_comments_link())
<li class="next">@php(next_comments_link(__('Newer comments &rarr;', 'sage')))</li>
<li class="next">@php next_comments_link(__('Newer comments &rarr;', 'sage')) @endphp</li>
@endif
</ul>
</nav>
@@ -34,5 +34,5 @@ if (post_password_required()) {
</div>
@endif
@php(comment_form())
@php comment_form() @endphp
</section>

View File

@@ -1,2 +1,2 @@
@php(the_content())
@php the_content() @endphp
{!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}

View File

@@ -1,4 +1,4 @@
<article @php(post_class())>
<article @php post_class() @endphp>
<header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{{ get_the_title() }}</a></h2>
@if (get_post_type() === 'post')
@@ -6,6 +6,6 @@
@endif
</header>
<div class="entry-summary">
@php(the_excerpt())
@php the_excerpt() @endphp
</div>
</article>

View File

@@ -1,13 +1,13 @@
<article @php(post_class())>
<article @php post_class() @endphp>
<header>
<h1 class="entry-title">{{ get_the_title() }}</h1>
@include('partials/entry-meta')
</header>
<div class="entry-content">
@php(the_content())
@php the_content() @endphp
</div>
<footer>
{!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
</footer>
@php(comments_template('/partials/comments.blade.php'))
@php comments_template('/partials/comments.blade.php') @endphp
</article>

View File

@@ -1,9 +1,9 @@
<article @php(post_class())>
<article @php post_class() @endphp>
<header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{{ get_the_title() }}</a></h2>
@include('partials/entry-meta')
</header>
<div class="entry-summary">
@php(the_excerpt())
@php the_excerpt() @endphp
</div>
</article>

View File

@@ -1,5 +1,5 @@
<footer class="content-info">
<div class="container">
@php(dynamic_sidebar('sidebar-footer'))
@php dynamic_sidebar('sidebar-footer') @endphp
</div>
</footer>

View File

@@ -2,5 +2,5 @@
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@php(wp_head())
@php wp_head() @endphp
</head>

View File

@@ -0,0 +1,7 @@
<form role="search" method="get" class="search-form" action="{{ $sf_action }}">
<label>
<span class="screen-reader-text">{{ $sf_screen_reader_text }}</span>
<input type="search" class="search-field" placeholder="{!! $sf_placeholder !!}" value="{{ $sf_current_query }}" name="s">
</label>
<input type="submit" class="search-submit" value="{{ $sf_submit_text }}">
</form>

View File

@@ -1 +1 @@
@php(dynamic_sidebar('sidebar-primary'))
@php dynamic_sidebar('sidebar-primary') @endphp

View File

@@ -10,7 +10,7 @@
{!! get_search_form(false) !!}
@endif
@while(have_posts()) @php(the_post())
@while(have_posts()) @php the_post() @endphp
@include('partials.content-search')
@endwhile

View File

@@ -1,7 +1,7 @@
@extends('layouts.app')
@section('content')
@while(have_posts()) @php(the_post())
@while(have_posts()) @php the_post() @endphp
@include('partials.content-single-'.get_post_type())
@endwhile
@endsection

View File

@@ -5,7 +5,7 @@
@extends('layouts.app')
@section('content')
@while(have_posts()) @php(the_post())
@while(have_posts()) @php the_post() @endphp
@include('partials.page-header')
@include('partials.content-page')
@endwhile

2967
yarn.lock

File diff suppressed because it is too large Load Diff