Merge pull request #1795 from roots/beta1

Beta1
This commit is contained in:
Ben Word
2017-01-10 08:25:19 -07:00
committed by GitHub
18 changed files with 5822 additions and 5542 deletions

View File

@@ -11,7 +11,12 @@
"node": true "node": true
}, },
"rules": { "rules": {
"react/require-extension": 0, "comma-dangle": ["error", {
"import/extensions": [1, { "js": "never" }] "arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}]
} }
} }

View File

@@ -1,4 +1,4 @@
### HEAD ### 9.0.0-beta.1: January 10th, 2016
* Update to Bootstrap 4 Alpha 6 ([#1792](https://github.com/roots/sage/pull/1792)) * Update to Bootstrap 4 Alpha 6 ([#1792](https://github.com/roots/sage/pull/1792))
* Add Blade ([#1765](https://github.com/roots/sage/pull/1765) and [#1777](https://github.com/roots/sage/pull/1777)) * Add Blade ([#1765](https://github.com/roots/sage/pull/1765) and [#1777](https://github.com/roots/sage/pull/1777))
* Remove sidebar defaults ([#1760](https://github.com/roots/sage/pull/1760)) * Remove sidebar defaults ([#1760](https://github.com/roots/sage/pull/1760))

View File

@@ -5,7 +5,7 @@
Sage is a WordPress starter theme with a modern development workflow. Sage is a WordPress starter theme with a modern development workflow.
**Sage 9 is in active development and is only currently in alpha. 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).** **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 ## Features

View File

@@ -4,7 +4,12 @@
"rules": { "rules": {
"import/no-extraneous-dependencies": 0, "import/no-extraneous-dependencies": 0,
"prefer-rest-params": 0, "prefer-rest-params": 0,
"react/require-extension": 0, "comma-dangle": ["error", {
"import/extensions": [1, { "js": "never" }] "arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}]
} }
} }

View File

@@ -31,12 +31,27 @@ const config = mergeWithConcat({
config.watch.push(`${path.basename(config.paths.assets)}/${config.copy}`); config.watch.push(`${path.basename(config.paths.assets)}/${config.copy}`);
config.watch = uniq(config.watch); config.watch = uniq(config.watch);
Object.keys(config.entry).forEach(id =>
config.entry[id].unshift(path.join(__dirname, 'public-path.js')));
module.exports = mergeWithConcat(config, { module.exports = mergeWithConcat(config, {
env: Object.assign({ production: isProduction, development: !isProduction }, argv.env), env: Object.assign({ production: isProduction, development: !isProduction }, argv.env),
publicPath: `${config.publicPath}/${path.basename(config.paths.dist)}/`, publicPath: `${config.publicPath}/${path.basename(config.paths.dist)}/`,
manifest: {}, manifest: {},
}); });
/**
* If your publicPath differs between environments, but you know it at compile time,
* then set SAGE_DIST_PATH as an environment variable before compiling.
* Example:
* SAGE_DIST_PATH=/wp-content/themes/sage/dist yarn build:production
*/
if (process.env.SAGE_DIST_PATH) {
module.exports.publicPath = process.env.SAGE_DIST_PATH;
}
/**
* If you don't know your publicPath at compile time, then uncomment the lines
* below and use WordPress's wp_localize_script() to set SAGE_DIST_PATH global.
* Example:
* wp_localize_script('sage/main.js', 'SAGE_DIST_PATH', get_theme_file_uri('dist/'))
*/
// Object.keys(module.exports.entry).forEach(id =>
// module.exports.entry[id].unshift(path.join(__dirname, 'public-path.js')));

View File

@@ -1,8 +1,7 @@
/* eslint-env browser */ /* eslint-env browser */
/* globals WEBPACK_PUBLIC_PATH */ /* globals SAGE_DIST_PATH */
// Dynamically set absolute public path from current protocol and host /** Dynamically set absolute public path from current protocol and host */
if (WEBPACK_PUBLIC_PATH) { if (SAGE_DIST_PATH) {
// eslint-disable-next-line no-undef, camelcase __webpack_public_path__ = SAGE_DIST_PATH; // eslint-disable-line no-undef, camelcase
__webpack_public_path__ = `${location.protocol}//${location.host}${WEBPACK_PUBLIC_PATH}`;
} }

View File

@@ -49,6 +49,7 @@ let webpackConfig = {
include: config.paths.assets, include: config.paths.assets,
loader: ExtractTextPlugin.extract({ loader: ExtractTextPlugin.extract({
fallbackLoader: 'style', fallbackLoader: 'style',
publicPath: '../',
loader: [ loader: [
`css?${sourceMapQueryStr}`, `css?${sourceMapQueryStr}`,
'postcss', 'postcss',
@@ -60,6 +61,7 @@ let webpackConfig = {
include: config.paths.assets, include: config.paths.assets,
loader: ExtractTextPlugin.extract({ loader: ExtractTextPlugin.extract({
fallbackLoader: 'style', fallbackLoader: 'style',
publicPath: '../',
loader: [ loader: [
`css?${sourceMapQueryStr}`, `css?${sourceMapQueryStr}`,
'postcss', 'postcss',
@@ -71,11 +73,9 @@ let webpackConfig = {
{ {
test: /\.(png|jpe?g|gif|svg|ico)$/, test: /\.(png|jpe?g|gif|svg|ico)$/,
include: config.paths.assets, include: config.paths.assets,
use: [ loader: `file?${qs.stringify({
`file?${qs.stringify({ name: `[path]${assetsFilenames}.[ext]`,
name: `[path]${assetsFilenames}.[ext]`, })}`,
})}`,
],
}, },
{ {
test: /\.(ttf|eot)$/, test: /\.(ttf|eot)$/,
@@ -122,9 +122,12 @@ let webpackConfig = {
root: config.paths.root, root: config.paths.root,
verbose: false, verbose: false,
}), }),
/**
* It would be nice to switch to copy-webpack-plugin, but
* unfortunately it doesn't provide a reliable way of
* tracking the before/after file names
*/
new CopyGlobsPlugin({ new CopyGlobsPlugin({
// It would be nice to switch to copy-webpack-plugin, but unfortunately it doesn't
// provide a reliable way of tracking the before/after file names
pattern: config.copy, pattern: config.copy,
output: `[path]${assetsFilenames}.[ext]`, output: `[path]${assetsFilenames}.[ext]`,
manifest: config.manifest, manifest: config.manifest,
@@ -141,11 +144,6 @@ let webpackConfig = {
Tether: 'tether', Tether: 'tether',
'window.Tether': 'tether', 'window.Tether': 'tether',
}), }),
new webpack.DefinePlugin({
WEBPACK_PUBLIC_PATH: (config.enabled.watcher)
? JSON.stringify(config.publicPath)
: false,
}),
new webpack.LoaderOptionsPlugin({ new webpack.LoaderOptionsPlugin({
minimize: config.enabled.optimize, minimize: config.enabled.optimize,
debug: config.enabled.watcher, debug: config.enabled.watcher,

View File

@@ -4,7 +4,10 @@ const BrowserSyncPlugin = require('browsersync-webpack-plugin');
const config = require('./config'); const config = require('./config');
module.exports = { module.exports = {
output: { pathinfo: true }, output: {
pathinfo: true,
publicPath: config.proxyUrl + config.publicPath,
},
devtool: '#cheap-module-source-map', devtool: '#cheap-module-source-map',
stats: false, stats: false,
plugins: [ plugins: [
@@ -13,7 +16,7 @@ module.exports = {
new webpack.NoErrorsPlugin(), new webpack.NoErrorsPlugin(),
new BrowserSyncPlugin({ new BrowserSyncPlugin({
target: config.devUrl, target: config.devUrl,
publicPath: config.publicPath, publicPath: '../',
proxyUrl: config.proxyUrl, proxyUrl: config.proxyUrl,
watch: config.watch, watch: config.watch,
}), }),

View File

@@ -71,6 +71,7 @@ module.exports = class {
this.globOptions.nodir = true; this.globOptions.nodir = true;
this.manifest = options.manifest || {}; this.manifest = options.manifest || {};
this.files = []; this.files = [];
this.started = false;
} }
apply(compiler) { apply(compiler) {
if (this.disable) { if (this.disable) {
@@ -78,8 +79,12 @@ module.exports = class {
} }
this.compiler = compiler; this.compiler = compiler;
this.resolveWorkingDirectory(); this.resolveWorkingDirectory();
compiler.plugin('emit', this.emitHandler.bind(this)); if (!this.started) {
compiler.plugin('after-emit', this.afterEmitHandler.bind(this)); compiler.plugin('emit', this.emitHandler.bind(this));
compiler.plugin('after-emit', this.afterEmitHandler.bind(this));
compiler.plugin('after-emit', this.afterEmitHandler.bind(this));
this.started = true;
}
} }
emitHandler(compilation, callback) { emitHandler(compilation, callback) {
this.compilation = compilation; this.compilation = compilation;

View File

@@ -1,23 +1,25 @@
// import external dependencies /** import external dependencies */
import 'jquery'; import 'jquery';
import 'bootstrap/dist/js/bootstrap'; import 'bootstrap/dist/js/bootstrap';
// import local dependencies /** import local dependencies */
import Router from './util/router'; import Router from './util/Router';
import common from './routes/Common'; import common from './routes/common';
import home from './routes/Home'; import home from './routes/home';
import aboutUs from './routes/About'; import aboutUs from './routes/about';
// Use this variable to set up the common and page specific functions. If you /**
// rename this variable, you will also need to rename the namespace below. * Populate Router instance with DOM routes
const routes = { * @type {Router} routes - An instance of our router
// All pages */
const routes = new Router({
/** All pages */
common, common,
// Home page /** Home page */
home, home,
// About us page, note the change from about-us to aboutUs. /** About Us page, note the change from about-us to aboutUs. */
aboutUs, aboutUs,
}; });
// Load Events /** Load Events */
jQuery(document).ready(() => new Router(routes).loadEvents()); jQuery(document).ready(() => routes.loadEvents());

View File

@@ -1,6 +1,6 @@
{ {
"name": "sage", "name": "sage",
"version": "9.0.0-alpha.4", "version": "9.0.0-beta.1",
"author": "Roots <team@roots.io>", "author": "Roots <team@roots.io>",
"homepage": "https://roots.io/sage/", "homepage": "https://roots.io/sage/",
"private": true, "private": true,
@@ -27,48 +27,48 @@
"test": "yarn run lint" "test": "yarn run lint"
}, },
"engines": { "engines": {
"node": ">= 4.5" "node": ">= 6.9.4"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.5.2", "autoprefixer": "^6.6.1",
"body-parser": "^1.15.2", "body-parser": "^1.15.2",
"browser-sync": "^2.17.5", "browser-sync": "^2.18.6",
"browsersync-webpack-plugin": "^0.1.1", "browsersync-webpack-plugin": "^0.2.0",
"buble": "^0.14.2", "buble": "^0.15.2",
"buble-loader": "^0.3.2", "buble-loader": "^0.4.0",
"clean-webpack-plugin": "^0.1.13", "clean-webpack-plugin": "^0.1.15",
"css-loader": "^0.25.0", "css-loader": "^0.26.1",
"cssnano": "^3.8.0", "cssnano": "^3.10.0",
"eslint": "^3.9.1", "eslint": "^3.13.1",
"eslint-config-airbnb": "^12.0.0", "eslint-config-airbnb": "^14.0.0",
"eslint-loader": "^1.6.1", "eslint-loader": "^1.6.1",
"eslint-plugin-import": "^2.0.1", "eslint-plugin-import": "^2.0.1",
"eslint-plugin-jsx-a11y": "^2.2.3", "eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.6.0", "eslint-plugin-react": "^6.9.0",
"extract-text-webpack-plugin": "^2.0.0-beta.4", "extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
"glob": "^7.1.1", "glob": "^7.1.1",
"imagemin-mozjpeg": "^6.0.0", "imagemin-mozjpeg": "^6.0.0",
"imagemin-webpack-plugin": "^1.2.1", "imagemin-webpack-plugin": "^1.4.4",
"imports-loader": "^0.6.5", "imports-loader": "^0.7.0",
"loader-utils": "^0.2.16", "loader-utils": "^0.2.16",
"lodash": "^4.16.6", "lodash": "^4.17.4",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"monkey-hot-loader": "github:rmarscher/monkey-hot-loader#webpack2-import", "monkey-hot-loader": "github:rmarscher/monkey-hot-loader#webpack2-import",
"node-sass": "^3.11.2", "node-sass": "^4.2.0",
"optimize-css-assets-webpack-plugin": "^1.3.0", "optimize-css-assets-webpack-plugin": "^1.3.0",
"postcss": "^5.2.5", "postcss": "^5.2.9",
"postcss-loader": "^1.1.0", "postcss-loader": "^1.2.1",
"qs": "^6.3.0", "qs": "^6.3.0",
"resolve-url-loader": "^1.6.0", "resolve-url-loader": "^1.6.1",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"sass-loader": "^4.0.2", "sass-loader": "^4.1.1",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"webpack": "^2.1.0-beta.26", "webpack": "^2.2.0-rc.3",
"webpack-assets-manifest": "^0.6.1", "webpack-assets-manifest": "^0.6.1",
"webpack-dev-middleware": "^1.8.4", "webpack-dev-middleware": "^1.9.0",
"webpack-hot-middleware": "^2.13.1" "webpack-hot-middleware": "^2.15.0"
}, },
"dependencies": { "dependencies": {
"bootstrap": "^4.0.0-alpha.6", "bootstrap": "^4.0.0-alpha.6",

View File

@@ -89,6 +89,14 @@ add_action('widgets_init', function () {
] + $config); ] + $config);
}); });
/**
* Updates the `$post` variable on each iteration of the loop.
* Note: updated value is only available for subsequently loaded views, such as partials
*/
add_action('the_post', function ($post) {
sage('blade')->share('post', $post);
});
/** /**
* Setup Sage options * Setup Sage options
*/ */

View File

@@ -2,7 +2,7 @@
Theme Name: Sage Starter Theme Theme Name: Sage Starter Theme
Theme URI: https://roots.io/sage/ Theme URI: https://roots.io/sage/
Description: Sage is a WordPress starter theme. <a href="https://github.com/roots/sage">Contribute on GitHub</a> Description: Sage is a WordPress starter theme. <a href="https://github.com/roots/sage">Contribute on GitHub</a>
Version: 9.0.0-alpha.4 Version: 9.0.0-beta.1
Author: Roots Author: Roots
Author URI: https://roots.io/ Author URI: https://roots.io/
Text Domain: sage Text Domain: sage

11182
yarn.lock

File diff suppressed because it is too large Load Diff