@@ -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
CHANGELOG.md
13
CHANGELOG.md
@@ -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))
|
||||
|
||||
14
README.md
14
README.md
@@ -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/).
|
||||
|
||||
@@ -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
|
||||
@@ -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`
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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);
|
||||
@@ -10,7 +10,7 @@ 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]',
|
||||
@@ -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: {},
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
const mergeWith = require('lodash/mergeWith');
|
||||
|
||||
module.exports = function mergeWithConcat() {
|
||||
const args = [].slice.call(arguments);
|
||||
args.push((a, b) => {
|
||||
if (Array.isArray(a) && Array.isArray(b)) {
|
||||
return a.concat(b);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
return mergeWith.apply(this, args);
|
||||
};
|
||||
@@ -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)(?)/],
|
||||
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,
|
||||
@@ -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)(?)/],
|
||||
loader: 'buble',
|
||||
options: { objectAssign: 'Object.assign' },
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: config.paths.assets,
|
||||
@@ -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 }),
|
||||
],
|
||||
},
|
||||
}),
|
||||
@@ -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) {
|
||||
@@ -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;
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** import external dependencies */
|
||||
import 'jquery';
|
||||
import 'bootstrap/dist/js/bootstrap';
|
||||
import 'bootstrap';
|
||||
|
||||
/** import local dependencies */
|
||||
import Router from './util/Router';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
// Grid system
|
||||
.main {
|
||||
@include make-col-ready();
|
||||
@include media-breakpoint-up(sm) {
|
||||
@include make-col($main-sm-columns);
|
||||
.sidebar-primary & {
|
||||
@include make-col($main-sm-columns - $sidebar-sm-columns);
|
||||
}
|
||||
}
|
||||
}
|
||||
.sidebar {
|
||||
@include make-col-ready();
|
||||
@include media-breakpoint-up(sm) {
|
||||
@include make-col($sidebar-sm-columns);
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
297
composer.lock
generated
297
composer.lock
generated
@@ -4,8 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "971d5df95d501fb79f467c7192ea7965",
|
||||
"content-hash": "50f25d093572c0558c11fb9498cb6603",
|
||||
"hash": "002e8b887ae673a31eb09214ecb0334a",
|
||||
"content-hash": "94588c58ddc098ab8b4424252ba31242",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
@@ -608,16 +608,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v3.1.8",
|
||||
"version": "v3.1.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "c058661c32f5b462722e36d120905940089cbd9a"
|
||||
"reference": "73f1c337907ba963af8028844fea1af98498dfff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a",
|
||||
"reference": "c058661c32f5b462722e36d120905940089cbd9a",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/73f1c337907ba963af8028844fea1af98498dfff",
|
||||
"reference": "73f1c337907ba963af8028844fea1af98498dfff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -661,20 +661,20 @@
|
||||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-11-15 12:55:20"
|
||||
"time": "2017-01-02 20:31:54"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v3.1.8",
|
||||
"version": "v3.1.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "74dcd370c8d057882575e535616fde935e411b19"
|
||||
"reference": "59687a255d1562f2c17b012418273862083d85f7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/74dcd370c8d057882575e535616fde935e411b19",
|
||||
"reference": "74dcd370c8d057882575e535616fde935e411b19",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/59687a255d1562f2c17b012418273862083d85f7",
|
||||
"reference": "59687a255d1562f2c17b012418273862083d85f7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -710,115 +710,10 @@
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-12-13 09:38:21"
|
||||
"time": "2017-01-02 20:31:54"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "pdepend/pdepend",
|
||||
"version": "2.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pdepend/pdepend.git",
|
||||
"reference": "8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pdepend/pdepend/zipball/8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90",
|
||||
"reference": "8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.7",
|
||||
"symfony/config": "^2.3.0|^3",
|
||||
"symfony/dependency-injection": "^2.3.0|^3",
|
||||
"symfony/filesystem": "^2.3.0|^3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.4.0,<4.8",
|
||||
"squizlabs/php_codesniffer": "^2.0.0"
|
||||
},
|
||||
"bin": [
|
||||
"src/bin/pdepend"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PDepend\\": "src/main/php/PDepend"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "Official version of pdepend to be handled with Composer",
|
||||
"time": "2016-11-23 20:25:02"
|
||||
},
|
||||
{
|
||||
"name": "phpmd/phpmd",
|
||||
"version": "2.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpmd/phpmd.git",
|
||||
"reference": "9298602a922cd8c46666df8d540a60bc5925ce55"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpmd/phpmd/zipball/9298602a922cd8c46666df8d540a60bc5925ce55",
|
||||
"reference": "9298602a922cd8c46666df8d540a60bc5925ce55",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"pdepend/pdepend": "^2.0.4",
|
||||
"php": ">=5.3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0",
|
||||
"squizlabs/php_codesniffer": "^2.0"
|
||||
},
|
||||
"bin": [
|
||||
"src/bin/phpmd"
|
||||
],
|
||||
"type": "project",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"PHPMD\\": "src/main/php"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Manuel Pichler",
|
||||
"email": "github@manuel-pichler.de",
|
||||
"homepage": "https://github.com/manuelpichler",
|
||||
"role": "Project Founder"
|
||||
},
|
||||
{
|
||||
"name": "Other contributors",
|
||||
"homepage": "https://github.com/phpmd/phpmd/graphs/contributors",
|
||||
"role": "Contributors"
|
||||
},
|
||||
{
|
||||
"name": "Marc Würth",
|
||||
"email": "ravage@bluewin.ch",
|
||||
"homepage": "https://github.com/ravage84",
|
||||
"role": "Project Maintainer"
|
||||
}
|
||||
],
|
||||
"description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.",
|
||||
"homepage": "http://phpmd.org/",
|
||||
"keywords": [
|
||||
"mess detection",
|
||||
"mess detector",
|
||||
"pdepend",
|
||||
"phpmd",
|
||||
"pmd"
|
||||
],
|
||||
"time": "2016-11-23 20:33:32"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "2.7.1",
|
||||
@@ -896,174 +791,6 @@
|
||||
"standards"
|
||||
],
|
||||
"time": "2016-11-30 04:02:31"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v3.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/config.git",
|
||||
"reference": "b4ec9f099599cfc5b7f4d07bb2e910781a2be5e4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/config/zipball/b4ec9f099599cfc5b7f4d07bb2e910781a2be5e4",
|
||||
"reference": "b4ec9f099599cfc5b7f4d07bb2e910781a2be5e4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/filesystem": "~2.8|~3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/yaml": "~3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Config\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Config Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-12-09 07:45:17"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v3.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dependency-injection.git",
|
||||
"reference": "037054501c41007c93b6de1b5c7a7acb83523593"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/037054501c41007c93b6de1b5c7a7acb83523593",
|
||||
"reference": "037054501c41007c93b6de1b5c7a7acb83523593",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/yaml": "<3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.8|~3.0",
|
||||
"symfony/expression-language": "~2.8|~3.0",
|
||||
"symfony/yaml": "~3.2"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/config": "",
|
||||
"symfony/expression-language": "For using expressions in service container configuration",
|
||||
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
|
||||
"symfony/yaml": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\DependencyInjection\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony DependencyInjection Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-12-08 15:27:33"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v3.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4",
|
||||
"reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Filesystem\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-11-24 00:46:43"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sage",
|
||||
"version": "9.0.0-beta.1",
|
||||
"version": "9.0.0-beta.2",
|
||||
"author": "Roots <team@roots.io>",
|
||||
"homepage": "https://roots.io/sage/",
|
||||
"private": true,
|
||||
@@ -22,7 +22,7 @@
|
||||
"build:production": "webpack --progress -p --config assets/build/webpack.config.js",
|
||||
"build:profile": "webpack --progress --profile --json --config assets/build/webpack.config.js",
|
||||
"start": "webpack --hide-modules --watch --config assets/build/webpack.config.js",
|
||||
"clean": "rimraf dist",
|
||||
"rmdist": "rimraf dist",
|
||||
"lint": "eslint assets/scripts assets/build",
|
||||
"test": "yarn run lint"
|
||||
},
|
||||
@@ -31,9 +31,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.6.1",
|
||||
"body-parser": "^1.15.2",
|
||||
"body-parser": "^1.16.0",
|
||||
"browser-sync": "^2.18.6",
|
||||
"browsersync-webpack-plugin": "^0.2.0",
|
||||
"browsersync-webpack-plugin": "^0.3.3",
|
||||
"buble": "^0.15.2",
|
||||
"buble-loader": "^0.4.0",
|
||||
"clean-webpack-plugin": "^0.1.15",
|
||||
@@ -41,7 +41,7 @@
|
||||
"cssnano": "^3.10.0",
|
||||
"eslint": "^3.13.1",
|
||||
"eslint-loader": "^1.6.1",
|
||||
"eslint-plugin-import": "^2.0.1",
|
||||
"eslint-plugin-import": "^2.2.0",
|
||||
"extract-text-webpack-plugin": "^2.0.0-beta.4",
|
||||
"file-loader": "^0.9.0",
|
||||
"glob": "^7.1.1",
|
||||
@@ -51,25 +51,24 @@
|
||||
"loader-utils": "^0.2.16",
|
||||
"lodash": "^4.17.4",
|
||||
"minimist": "^1.2.0",
|
||||
"monkey-hot-loader": "github:rmarscher/monkey-hot-loader#webpack2-import",
|
||||
"node-sass": "^4.2.0",
|
||||
"node-sass": "^4.3.0",
|
||||
"optimize-css-assets-webpack-plugin": "^1.3.0",
|
||||
"postcss": "^5.2.9",
|
||||
"postcss-loader": "^1.2.1",
|
||||
"postcss": "^5.2.10",
|
||||
"postcss-loader": "^1.2.2",
|
||||
"qs": "^6.3.0",
|
||||
"resolve-url-loader": "^1.6.1",
|
||||
"rimraf": "^2.5.4",
|
||||
"sass-loader": "^4.1.1",
|
||||
"style-loader": "^0.13.1",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^2.2.0-rc.3",
|
||||
"webpack": "^2.2.0",
|
||||
"webpack-assets-manifest": "^0.6.1",
|
||||
"webpack-dev-middleware": "^1.9.0",
|
||||
"webpack-hot-middleware": "^2.15.0"
|
||||
"webpack-hot-middleware": "^2.15.0",
|
||||
"webpack-merge": "^2.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "^4.0.0-alpha.6",
|
||||
"font-awesome": "^4.7.0",
|
||||
"jquery": "1.12.4 - 3"
|
||||
}
|
||||
}
|
||||
|
||||
101
src/lib/Sage/PostCreateProject.php
Executable file
101
src/lib/Sage/PostCreateProject.php
Executable file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Roots\Sage;
|
||||
|
||||
use Composer\Script\Event;
|
||||
|
||||
class PostCreateProject
|
||||
{
|
||||
public static function updateHeaders(Event $event)
|
||||
{
|
||||
// @codingStandardsIgnoreStart
|
||||
$io = $event->getIO();
|
||||
|
||||
if ($io->isInteractive()) {
|
||||
$io->write('<info>Define theme headers. Press enter key for default.</info>');
|
||||
|
||||
$theme_headers_default = [
|
||||
'name' => 'Sage Starter Theme',
|
||||
'uri' => 'https://roots.io/sage/',
|
||||
'description' => 'Sage is a WordPress starter theme.',
|
||||
'version' => '9.0.0-beta.2',
|
||||
'author' => 'Roots',
|
||||
'author_uri' => 'https://roots.io/'
|
||||
];
|
||||
$theme_headers = [
|
||||
'name' => $io->ask('<info>Theme Name [<comment>'.$theme_headers_default['name'].'</comment>]:</info> ', $theme_headers_default['name']),
|
||||
'uri' => $io->ask('<info>Theme URI [<comment>'.$theme_headers_default['uri'].'</comment>]:</info> ', $theme_headers_default['uri']),
|
||||
'description' => $io->ask('<info>Theme Description [<comment>'.$theme_headers_default['description'].'</comment>]:</info> ', $theme_headers_default['description']),
|
||||
'version' => $io->ask('<info>Theme Version [<comment>'.$theme_headers_default['version'].'</comment>]:</info> ', $theme_headers_default['version']),
|
||||
'author' => $io->ask('<info>Theme Author [<comment>'.$theme_headers_default['author'].'</comment>]:</info> ', $theme_headers_default['author']),
|
||||
'author_uri' => $io->ask('<info>Theme Author URI [<comment>'.$theme_headers_default['author_uri'].'</comment>]:</info> ', $theme_headers_default['author_uri'])
|
||||
];
|
||||
|
||||
file_put_contents('style.css', str_replace($theme_headers_default, $theme_headers, file_get_contents('style.css')));
|
||||
}
|
||||
}
|
||||
|
||||
public static function selectFramework(Event $event)
|
||||
{
|
||||
$io = $event->getIO();
|
||||
$default_framework_pattern = '"bootstrap": ".*"';
|
||||
|
||||
$files_to_clear = [
|
||||
'assets/styles/components/_comments.scss',
|
||||
'assets/styles/components/_forms.scss',
|
||||
'assets/styles/components/_wp-classes.scss',
|
||||
'assets/styles/layouts/_header.scss',
|
||||
];
|
||||
|
||||
|
||||
if ($io->isInteractive()) {
|
||||
$frameworks = [
|
||||
'Bootstrap',
|
||||
'Foundation',
|
||||
'None'
|
||||
];
|
||||
$framework = $io->select('<info>Select a CSS framework</info> <comment>(Default: Bootstrap)</comment>', $frameworks, 0);
|
||||
|
||||
switch($framework) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
file_put_contents('package.json', preg_replace("/{$default_framework_pattern}/", '"foundation-sites": "6.3.0"', file_get_contents('package.json')));
|
||||
file_put_contents('assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '@import "~foundation-sites/scss/foundation";' . "\n" . '@include foundation-everything;' . "\n", file_get_contents('assets/styles/main.scss')));
|
||||
file_put_contents('assets/scripts/main.js', str_replace("import 'bootstrap';\n", "import 'foundation-sites/dist/js/foundation';\n", file_get_contents('assets/scripts/main.js')));
|
||||
foreach($files_to_clear as $file) {
|
||||
file_put_contents($file, '');
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
file_put_contents('package.json', preg_replace("/\s+{$default_framework_pattern},/", '', file_get_contents('package.json')));
|
||||
file_put_contents('assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '', file_get_contents('assets/styles/main.scss')));
|
||||
file_put_contents('assets/scripts/main.js', str_replace("import 'bootstrap';\n", '', file_get_contents('assets/scripts/main.js')));
|
||||
foreach($files_to_clear as $file) {
|
||||
file_put_contents($file, '');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function addFontAwesome(Event $event)
|
||||
{
|
||||
$io = $event->getIO();
|
||||
|
||||
if ($io->isInteractive()) {
|
||||
if ($io->askConfirmation('<info>Add Font Awesome?</info> [<comment>y,N</comment>]? ', false)) {
|
||||
$package = json_decode(file_get_contents('package.json'), true);
|
||||
$dependencies = $package['dependencies'];
|
||||
$dependencies = array_merge($dependencies, ['font-awesome' => '^4.7.0']);
|
||||
$package['dependencies'] = $dependencies;
|
||||
$package = str_replace(' ', ' ', json_encode($package, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n");
|
||||
|
||||
$import_dep_str = '// Import npm dependencies' . "\n";
|
||||
file_put_contents('assets/styles/main.scss', str_replace($import_dep_str, $import_dep_str . '@import "~font-awesome/scss/font-awesome";' . "\n", file_get_contents('assets/styles/main.scss')));
|
||||
file_put_contents('assets/styles/common/_variables.scss', "\n" . '$fa-font-path: \'~font-awesome/fonts\';' . "\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
Theme Name: Sage Starter Theme
|
||||
Theme URI: https://roots.io/sage/
|
||||
Description: Sage is a WordPress starter theme. <a href="https://github.com/roots/sage">Contribute on GitHub</a>
|
||||
Version: 9.0.0-beta.1
|
||||
Description: Sage is a WordPress starter theme.
|
||||
Version: 9.0.0-beta.2
|
||||
Author: Roots
|
||||
Author URI: https://roots.io/
|
||||
Text Domain: sage
|
||||
|
||||
@@ -2,15 +2,10 @@
|
||||
<html @php(language_attributes())>
|
||||
@include('partials.head')
|
||||
<body @php(body_class())>
|
||||
<!--[if IE]>
|
||||
<div class="alert alert-warning">
|
||||
{!! __('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage') !!}
|
||||
</div>
|
||||
<![endif]-->
|
||||
@php(do_action('get_header'))
|
||||
@include('partials.header')
|
||||
<div class="wrap container" role="document">
|
||||
<div class="content row">
|
||||
<div class="content">
|
||||
<main class="main">
|
||||
@yield('content')
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user