Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta 2 #1806

Merged
merged 28 commits into from
Jan 19, 2017
Merged

Beta 2 #1806

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6b37080
Allow autoprefixer's browser versions to be configured
oxyc Jan 10, 2017
7d87c3d
rename clean task
psorensen Jan 10, 2017
faf77d7
Update README to include new task name
psorensen Jan 10, 2017
f4cf20b
Respect autoprefixer browsers when stripping vendor prefixes with css…
oxyc Jan 10, 2017
eff6644
Update travis
psorensen Jan 10, 2017
417ce46
Fix for publicPath
retlehs Jan 11, 2017
21c6d66
Merge pull request #1800 from psorensen/issue/1797
retlehs Jan 11, 2017
d954213
Merge pull request #1798 from oxyc/patch-1
retlehs Jan 11, 2017
1279552
Use NoEmitOnErrorsPlugin, thanks @eshimischi
retlehs Jan 11, 2017
7a3e792
Update CHANGELOG, bump version [ci skip]
retlehs Jan 11, 2017
8bd55bb
Revert to yarn.lock from master, previous Webpack RC
retlehs Jan 11, 2017
9fca64a
Remove outdated browser warning
retlehs Jan 13, 2017
646c636
Remove grid defaults
retlehs Jan 13, 2017
596f66f
Merge pull request #1808 from roots/remove-grid-defaults
retlehs Jan 13, 2017
865ade5
Remove Font Awesome
retlehs Jan 13, 2017
66b70b6
Update CHANGELOG [ci skip]
retlehs Jan 13, 2017
ea7323a
Merge pull request #1809 from roots/remove-font-awesome
retlehs Jan 13, 2017
b91ab89
Add option to remove Bootstrap when creating project (#1810)
retlehs Jan 15, 2017
70328d9
Missed in #1809
retlehs Jan 15, 2017
c2c43df
Add option to change theme file headers
retlehs Jan 15, 2017
5b5d362
Update README, CHANGELOG [ci skip]
retlehs Jan 15, 2017
1826102
Merge pull request #1811 from roots/option-to-change-theme-file-headers
retlehs Jan 15, 2017
1f8f24f
Add option to add Font Awesome
retlehs Jan 17, 2017
89b4d1c
Merge pull request #1812 from roots/option-to-add-font-awesome
retlehs Jan 17, 2017
3909bf7
Add option to select CSS framework, add Foundation as an option (#1813)
retlehs Jan 18, 2017
4adbc34
Fix browsersync (#1815)
QWp6t Jan 19, 2017
360dfc9
Fix Bootstrap JS removal/replacement
retlehs Jan 19, 2017
c63d155
Update CHANGELOG [ci skip]
retlehs Jan 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ install:
script:
- yarn run test
- yarn run build
- yarn run clean
- yarn run rmdist
- yarn run "build:production"
- composer test
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
### 9.0.0-beta.2: January 19th, 2016
* Fix Browersync ([#1815](https://github.com/roots/sage/pull/1815))
* Add option to select CSS framework, add Foundation as an option ([#1813](https://github.com/roots/sage/pull/1813))
* Add option to add Font Awesome ([#1812](https://github.com/roots/sage/pull/1812))
* Add option to change theme file headers ([#1811](https://github.com/roots/sage/pull/1811))
* Add option to remove Bootstrap ([#1810](https://github.com/roots/sage/pull/1810))
* Remove Font Awesome ([#1809](https://github.com/roots/sage/pull/1809))
* Remove grid defaults ([#1808](https://github.com/roots/sage/pull/1808))
* Fix for `publicPath` ([#1806](https://github.com/roots/sage/pull/1806))
* Update clean task name ([#1800](https://github.com/roots/sage/pull/1800))
* Allow browser versions to be configured in `config.json` ([#1798](https://github.com/roots/sage/pull/1798))
* Use stock ESLint ([#1796](https://github.com/roots/sage/pull/1796))

### 9.0.0-beta.1: January 10th, 2016
* 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))
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ Sage is a WordPress starter theme with a modern development workflow.
* ES6 for 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
* [Bootstrap 4](http://getbootstrap.com/) for a front-end framework (can be removed or replaced)
* [Laravel's Blade](https://laravel.com/docs/5.3/blade) as a templating engine
* CSS framework options:
* [Bootstrap 4](http://getbootstrap.com/)
* [Foundation](http://foundation.zurb.com/)
* None (blank slate)


See a working example at [roots-example-project.com](https://roots-example-project.com/).

Expand All @@ -36,6 +40,12 @@ Install Sage using Composer from your WordPress themes directory (replace `your-
$ composer create-project roots/sage your-theme-name dev-master
```

During theme installation you will have the options to:

* Update theme headers (theme name, description, author, etc.)
* Select a CSS framework (Bootstrap, Foundation, none)
* Add Font Awesome

## Theme structure

```shell
Expand Down Expand Up @@ -95,7 +105,7 @@ You now have all the necessary dependencies to run the build process.

#### Additional commands

* `yarn run clean` — Remove your `dist/` folder
* `yarn run rmdist` — Remove your `dist/` folder
* `yarn run lint` — Run eslint against your assets and build scripts
* `composer test` — Check your PHP for code smells with `phpmd` and PSR-2 compliance with `phpcs`

Expand Down
7 changes: 4 additions & 3 deletions assets/build/config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const path = require('path');
const argv = require('minimist')(process.argv.slice(2));
const uniq = require('lodash/uniq');
const merge = require('webpack-merge');

const mergeWithConcat = require('./util/mergeWithConcat');
const userConfig = require('../config');

const isProduction = !!((argv.env && argv.env.production) || argv.p);
const rootPath = (userConfig.paths && userConfig.paths.root)
? userConfig.paths.root
: process.cwd();

const config = mergeWithConcat({
const config = merge({
copy: 'images/**/*',
proxyUrl: 'http://localhost:3000',
cacheBusting: '[name]_[hash]',
Expand All @@ -26,12 +26,13 @@ const config = mergeWithConcat({
watcher: !!argv.watch,
},
watch: [],
browsers: [],
}, userConfig);

config.watch.push(`${path.basename(config.paths.assets)}/${config.copy}`);
config.watch = uniq(config.watch);

module.exports = mergeWithConcat(config, {
module.exports = merge(config, {
env: Object.assign({ production: isProduction, development: !isProduction }, argv.env),
publicPath: `${config.publicPath}/${path.basename(config.paths.dist)}/`,
manifest: {},
Expand Down
4 changes: 2 additions & 2 deletions assets/build/util/addHotMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module.exports = (entry) => {
const results = {};
const hotMiddlewareScript = `webpack-hot-middleware/client?${qs.stringify({
timeout: 20000,
reload: false,
reload: true,
})}`;

Object.keys(entry).forEach((name) => {
results[name] = Array.isArray(entry[name]) ? entry[name].slice(0) : [entry[name]];
results[name].push(hotMiddlewareScript);
results[name].unshift(hotMiddlewareScript);
});
return results;
};
12 changes: 0 additions & 12 deletions assets/build/util/mergeWithConcat.js

This file was deleted.

30 changes: 11 additions & 19 deletions assets/build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,17 @@

const webpack = require('webpack');
const qs = require('qs');
const merge = require('webpack-merge');
const autoprefixer = require('autoprefixer');
const CleanPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const CopyGlobsPlugin = require('./webpack.plugin.copyglobs');
const mergeWithConcat = require('./util/mergeWithConcat');
const config = require('./config');

const assetsFilenames = (config.enabled.cacheBusting) ? config.cacheBusting : '[name]';
const sourceMapQueryStr = (config.enabled.sourceMaps) ? '+sourceMap' : '-sourceMap';

const jsLoader = {
test: /\.js$/,
exclude: [/(node_modules|bower_components)(?![/|\\](bootstrap|foundation-sites))/],
use: [{
loader: 'buble',
options: { objectAssign: 'Object.assign' },
}],
};

if (config.enabled.watcher) {
jsLoader.use.unshift('monkey-hot?sourceType=module');
}

let webpackConfig = {
context: config.paths.assets,
entry: config.entry,
Expand All @@ -37,13 +24,18 @@ let webpackConfig = {
},
module: {
rules: [
jsLoader,
{
enforce: 'pre',
test: /\.js?$/,
include: config.paths.assets,
loader: 'eslint',
},
{
test: /\.js$/,
exclude: [/(node_modules|bower_components)(?![/|\\](bootstrap|foundation-sites))/],
loader: 'buble',
options: { objectAssign: 'Object.assign' },
},
{
test: /\.css$/,
include: config.paths.assets,
Expand Down Expand Up @@ -155,7 +147,7 @@ let webpackConfig = {
output: { path: config.paths.dist },
context: config.paths.assets,
postcss: [
autoprefixer({ browsers: ['last 2 versions', 'android 4', 'opera 12'] }),
autoprefixer({ browsers: config.browsers }),
],
},
}),
Expand All @@ -171,11 +163,11 @@ let webpackConfig = {
/* eslint-disable global-require */ /** Let's only load dependencies as needed */

if (config.enabled.optimize) {
webpackConfig = mergeWithConcat(webpackConfig, require('./webpack.config.optimize'));
webpackConfig = merge(webpackConfig, require('./webpack.config.optimize'));
}

if (config.env.production) {
webpackConfig.plugins.push(new webpack.NoErrorsPlugin());
webpackConfig.plugins.push(new webpack.NoEmitOnErrorsPlugin());
}

if (config.enabled.cacheBusting) {
Expand All @@ -194,7 +186,7 @@ if (config.enabled.cacheBusting) {

if (config.enabled.watcher) {
webpackConfig.entry = require('./util/addHotMiddleware')(webpackConfig.entry);
webpackConfig = mergeWithConcat(webpackConfig, require('./webpack.config.watch'));
webpackConfig = merge(webpackConfig, require('./webpack.config.watch'));
}

module.exports = webpackConfig;
5 changes: 4 additions & 1 deletion assets/build/webpack.config.optimize.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ module.exports = {
plugins: [
new OptimizeCssAssetsPlugin({
cssProcessor: cssnano,
cssProcessorOptions: { discardComments: { removeAll: true } },
cssProcessorOptions: {
discardComments: { removeAll: true },
autoprefixer: { browsers: config.browsers },
},
canPrint: true,
}),
new ImageminPlugin({
Expand Down
3 changes: 1 addition & 2 deletions assets/build/webpack.config.watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ module.exports = {
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new BrowserSyncPlugin({
target: config.devUrl,
publicPath: '../',
proxyUrl: config.proxyUrl,
watch: config.watch,
}),
Expand Down
1 change: 0 additions & 1 deletion assets/build/webpack.plugin.copyglobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ module.exports = class {
if (!this.started) {
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;
}
}
Expand Down
7 changes: 6 additions & 1 deletion assets/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
"publicPath": "/app/themes/sage",
"devUrl": "http://example.dev",
"proxyUrl": "http://localhost:3000",
"cacheBusting": "[name]_[hash:8]"
"cacheBusting": "[name]_[hash:8]",
"browsers": [
"last 2 versions",
"android 4",
"opera 12"
]
}
2 changes: 1 addition & 1 deletion assets/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** import external dependencies */
import 'jquery';
import 'bootstrap/dist/js/bootstrap';
import 'bootstrap';

/** import local dependencies */
import Router from './util/Router';
Expand Down
7 changes: 0 additions & 7 deletions assets/styles/common/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
// Colors
$brand-primary: #27ae60;

// Grid settings
$main-sm-columns: 12;
$sidebar-sm-columns: 4;

// Vendor variables
$fa-font-path: '~font-awesome/fonts';
16 changes: 0 additions & 16 deletions assets/styles/components/_grid.scss

This file was deleted.

2 changes: 0 additions & 2 deletions assets/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

// Import npm dependencies
@import "~bootstrap/scss/bootstrap";
@import "~font-awesome/scss/font-awesome";

@import "common/global";
@import "components/buttons";
@import "components/comments";
@import "components/forms";
@import "components/grid";
@import "components/wp-classes";
@import "layouts/header";
@import "layouts/sidebar";
Expand Down
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@
"illuminate/config": "~5.3.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.5.1",
"phpmd/phpmd": "^2.4.2"
"squizlabs/php_codesniffer": "^2.5.1"
},
"scripts": {
"test": [
"vendor/bin/phpcs",
"vendor/bin/phpmd src text cleancode,codesize,controversial,design,naming,unusedcode"
"vendor/bin/phpcs"
],
"post-create-project-cmd": [
"Roots\\Sage\\PostCreateProject::updateHeaders",
"Roots\\Sage\\PostCreateProject::selectFramework",
"Roots\\Sage\\PostCreateProject::addFontAwesome"
]
}
}
Loading