From 0fab46fe14490323c8cc1e783ca7c2e881ce52c1 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Fri, 24 Mar 2017 18:34:01 -0600 Subject: [PATCH 1/4] Rename base.blade.php to app.blade.php --- CHANGELOG.md | 1 + templates/404.blade.php | 2 +- templates/index.blade.php | 2 +- templates/layouts/{base.blade.php => app.blade.php} | 0 templates/page.blade.php | 2 +- templates/search.blade.php | 2 +- templates/single.blade.php | 3 +-- templates/template-custom.blade.php | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename templates/layouts/{base.blade.php => app.blade.php} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e67af4e08..07cf1b5d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### HEAD +* Rename `base.blade.php` to `app.blade.php` ([#1864](https://github.com/roots/sage/pull/1864)) * Add option to configure build settings ([#1822](https://github.com/roots/sage/pull/1822)) * Add support for HTML injection ([#1817](https://github.com/roots/sage/pull/1817)) diff --git a/templates/404.blade.php b/templates/404.blade.php index 384c3949d5..16fb8d5ea5 100644 --- a/templates/404.blade.php +++ b/templates/404.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.base') +@extends('layouts.app') @section('content') @include('partials.page-header') diff --git a/templates/index.blade.php b/templates/index.blade.php index bb3ef9053d..f91575cd08 100644 --- a/templates/index.blade.php +++ b/templates/index.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.base') +@extends('layouts.app') @section('content') @include('partials.page-header') diff --git a/templates/layouts/base.blade.php b/templates/layouts/app.blade.php similarity index 100% rename from templates/layouts/base.blade.php rename to templates/layouts/app.blade.php diff --git a/templates/page.blade.php b/templates/page.blade.php index d18f59b4f1..edae985537 100644 --- a/templates/page.blade.php +++ b/templates/page.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.base') +@extends('layouts.app') @section('content') @while(have_posts()) @php(the_post()) diff --git a/templates/search.blade.php b/templates/search.blade.php index e5897c5ee1..f0a021e3eb 100644 --- a/templates/search.blade.php +++ b/templates/search.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.base') +@extends('layouts.app') @section('content') @include('partials.page-header') diff --git a/templates/single.blade.php b/templates/single.blade.php index 62e9c852b7..b94c206716 100644 --- a/templates/single.blade.php +++ b/templates/single.blade.php @@ -1,8 +1,7 @@ -@extends('layouts.base') +@extends('layouts.app') @section('content') @while(have_posts()) @php(the_post()) @include('partials/content-single-'.get_post_type()) @endwhile @endsection - diff --git a/templates/template-custom.blade.php b/templates/template-custom.blade.php index 460854d3b1..762a54a364 100644 --- a/templates/template-custom.blade.php +++ b/templates/template-custom.blade.php @@ -2,7 +2,7 @@ Template Name: Custom Template --}} -@extends('layouts.base') +@extends('layouts.app') @section('content') @while(have_posts()) @php(the_post()) From 700a556c02eb6e76ed207115a00baa2e35b53e5e Mon Sep 17 00:00:00 2001 From: Ben Word Date: Mon, 3 Apr 2017 18:26:26 -0600 Subject: [PATCH 2/4] templates/ -> resources/views/ --- .editorconfig | 2 +- CHANGELOG.md | 2 +- README.md | 21 ++++++------- functions.php | 12 ++++---- phpcs.xml | 30 +++++++++---------- {templates => resources/views}/404.blade.php | 0 .../views}/index.blade.php | 0 .../views}/layouts/app.blade.php | 0 {templates => resources/views}/page.blade.php | 0 .../views}/partials/comments.blade.php | 0 .../views}/partials/content-page.blade.php | 0 .../views}/partials/content-search.blade.php | 0 .../views}/partials/content-single.blade.php | 2 +- .../views}/partials/content.blade.php | 0 .../views}/partials/entry-meta.blade.php | 0 .../views}/partials/footer.blade.php | 0 .../views}/partials/head.blade.php | 0 .../views}/partials/header.blade.php | 0 .../views}/partials/page-header.blade.php | 0 .../views}/partials/sidebar.blade.php | 0 .../views}/search.blade.php | 0 .../views}/single.blade.php | 0 .../views}/template-custom.blade.php | 0 src/filters.php | 4 +-- src/setup.php | 6 ++-- 25 files changed, 41 insertions(+), 38 deletions(-) rename {templates => resources/views}/404.blade.php (100%) rename {templates => resources/views}/index.blade.php (100%) rename {templates => resources/views}/layouts/app.blade.php (100%) rename {templates => resources/views}/page.blade.php (100%) rename {templates => resources/views}/partials/comments.blade.php (100%) rename {templates => resources/views}/partials/content-page.blade.php (100%) rename {templates => resources/views}/partials/content-search.blade.php (100%) rename {templates => resources/views}/partials/content-single.blade.php (83%) rename {templates => resources/views}/partials/content.blade.php (100%) rename {templates => resources/views}/partials/entry-meta.blade.php (100%) rename {templates => resources/views}/partials/footer.blade.php (100%) rename {templates => resources/views}/partials/head.blade.php (100%) rename {templates => resources/views}/partials/header.blade.php (100%) rename {templates => resources/views}/partials/page-header.blade.php (100%) rename {templates => resources/views}/partials/sidebar.blade.php (100%) rename {templates => resources/views}/search.blade.php (100%) rename {templates => resources/views}/single.blade.php (100%) rename {templates => resources/views}/template-custom.blade.php (100%) diff --git a/.editorconfig b/.editorconfig index 8fcbf507f8..e5c8d6ccc7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,5 +13,5 @@ insert_final_newline = true [*.php] indent_size = 4 -[templates/**.php] +[resources/views/**.php] indent_size = 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 07cf1b5d2b..03d485705b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ### HEAD -* Rename `base.blade.php` to `app.blade.php` ([#1864](https://github.com/roots/sage/pull/1864)) +* Move `templates/` to `resources/views/`, rename `base.blade.php` to `app.blade.php`, ([#1864](https://github.com/roots/sage/pull/1864)) * Add option to configure build settings ([#1822](https://github.com/roots/sage/pull/1822)) * Add support for HTML injection ([#1817](https://github.com/roots/sage/pull/1817)) diff --git a/README.md b/README.md index e3e3c96edd..b6f8a1b533 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,6 @@ During theme installation you will have the options to: ```shell themes/your-theme-name/ # → Root of your Sage based theme -├── assets # → Front-end assets -│   ├── config.json # → Settings for compiled assets -│   ├── build/ # → Webpack and ESLint config -│   ├── fonts/ # → Theme fonts -│   ├── images/ # → Theme images -│   ├── scripts/ # → Theme JS -│   └── styles/ # → Theme stylesheets ├── composer.json # → Autoloading for `src/` files ├── composer.lock # → Composer lock file (never edit) ├── dist/ # → Built theme assets (never edit) @@ -75,9 +68,17 @@ themes/your-theme-name/ # → Root of your Sage based theme │   ├── helpers.php # → Helper functions │   └── setup.php # → Theme setup ├── style.css # → Theme meta information -├── templates/ # → Theme templates -│   ├── layouts/ # → Base templates -│   └── partials/ # → Partial templates +├── resources/ # → Theme assets and templates +├── ├── assets/ # → Front-end assets +│   │ ├── config.json # → Settings for compiled assets +│   │ ├── build/ # → Webpack and ESLint config +│   │ ├── fonts/ # → Theme fonts +│   │ ├── images/ # → Theme images +│   │ ├── scripts/ # → Theme JS +│   │ └── styles/ # → Theme stylesheets +│   └── views/ # → Theme templates +│   ├── layouts/ # → Base templates +│   └── partials/ # → Partial templates └── vendor/ # → Composer packages (never edit) ``` diff --git a/functions.php b/functions.php index 87ac65864b..07e0b40df1 100644 --- a/functions.php +++ b/functions.php @@ -60,10 +60,10 @@ /** * Here's what's happening with these hooks: * 1. WordPress initially detects theme in themes/sage - * 2. Upon activation, we tell WordPress that the theme is actually in themes/sage/templates + * 2. Upon activation, we tell WordPress that the theme is actually in themes/sage/resources/views * 3. When we call get_template_directory() or get_template_directory_uri(), we point it back to themes/sage * - * We do this so that the Template Hierarchy will look in themes/sage/templates for core WordPress themes + * We do this so that the Template Hierarchy will look in themes/sage/resources/views for core WordPress themes * But functions.php, style.css, and index.php are all still located in themes/sage * * This is not compatible with the WordPress Customizer theme preview prior to theme activation @@ -72,16 +72,16 @@ * get_stylesheet_directory() -> /srv/www/example.com/current/web/app/themes/sage * locate_template() * ├── STYLESHEETPATH -> /srv/www/example.com/current/web/app/themes/sage - * └── TEMPLATEPATH -> /srv/www/example.com/current/web/app/themes/sage/templates + * └── TEMPLATEPATH -> /srv/www/example.com/current/web/app/themes/sage/resources/views */ if (is_customize_preview() && isset($_GET['theme'])) { $sage_error(__('Theme must be activated prior to using the customizer.', 'sage')); } add_filter('template', function ($stylesheet) { - return dirname($stylesheet); + return dirname(dirname($stylesheet)); }); -if (basename($stylesheet = get_option('template')) !== 'templates') { - update_option('template', "{$stylesheet}/templates"); +if (basename($stylesheet = get_option('template')) !== 'resources/views') { + update_option('template', "{$stylesheet}/resources/views"); wp_redirect($_SERVER['REQUEST_URI']); exit(); } diff --git a/phpcs.xml b/phpcs.xml index 4b4b390097..df223957c5 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -6,7 +6,7 @@ functions.php index.php src - templates + resources/views @@ -17,55 +17,55 @@ - - + + - templates + resources/views - templates + resources/views - templates + resources/views - templates + resources/views - templates + resources/views - templates + resources/views - templates + resources/views - + - templates + resources/views - templates - + resources/views + - templates + resources/views diff --git a/templates/404.blade.php b/resources/views/404.blade.php similarity index 100% rename from templates/404.blade.php rename to resources/views/404.blade.php diff --git a/templates/index.blade.php b/resources/views/index.blade.php similarity index 100% rename from templates/index.blade.php rename to resources/views/index.blade.php diff --git a/templates/layouts/app.blade.php b/resources/views/layouts/app.blade.php similarity index 100% rename from templates/layouts/app.blade.php rename to resources/views/layouts/app.blade.php diff --git a/templates/page.blade.php b/resources/views/page.blade.php similarity index 100% rename from templates/page.blade.php rename to resources/views/page.blade.php diff --git a/templates/partials/comments.blade.php b/resources/views/partials/comments.blade.php similarity index 100% rename from templates/partials/comments.blade.php rename to resources/views/partials/comments.blade.php diff --git a/templates/partials/content-page.blade.php b/resources/views/partials/content-page.blade.php similarity index 100% rename from templates/partials/content-page.blade.php rename to resources/views/partials/content-page.blade.php diff --git a/templates/partials/content-search.blade.php b/resources/views/partials/content-search.blade.php similarity index 100% rename from templates/partials/content-search.blade.php rename to resources/views/partials/content-search.blade.php diff --git a/templates/partials/content-single.blade.php b/resources/views/partials/content-single.blade.php similarity index 83% rename from templates/partials/content-single.blade.php rename to resources/views/partials/content-single.blade.php index 30a2f9ca27..653804b4e6 100644 --- a/templates/partials/content-single.blade.php +++ b/resources/views/partials/content-single.blade.php @@ -9,5 +9,5 @@
{!! wp_link_pages(['echo' => 0, 'before' => '']) !!}
- @php(comments_template('/templates/partials/comments.blade.php')) + @php(comments_template('/resources/views/partials/comments.blade.php')) diff --git a/templates/partials/content.blade.php b/resources/views/partials/content.blade.php similarity index 100% rename from templates/partials/content.blade.php rename to resources/views/partials/content.blade.php diff --git a/templates/partials/entry-meta.blade.php b/resources/views/partials/entry-meta.blade.php similarity index 100% rename from templates/partials/entry-meta.blade.php rename to resources/views/partials/entry-meta.blade.php diff --git a/templates/partials/footer.blade.php b/resources/views/partials/footer.blade.php similarity index 100% rename from templates/partials/footer.blade.php rename to resources/views/partials/footer.blade.php diff --git a/templates/partials/head.blade.php b/resources/views/partials/head.blade.php similarity index 100% rename from templates/partials/head.blade.php rename to resources/views/partials/head.blade.php diff --git a/templates/partials/header.blade.php b/resources/views/partials/header.blade.php similarity index 100% rename from templates/partials/header.blade.php rename to resources/views/partials/header.blade.php diff --git a/templates/partials/page-header.blade.php b/resources/views/partials/page-header.blade.php similarity index 100% rename from templates/partials/page-header.blade.php rename to resources/views/partials/page-header.blade.php diff --git a/templates/partials/sidebar.blade.php b/resources/views/partials/sidebar.blade.php similarity index 100% rename from templates/partials/sidebar.blade.php rename to resources/views/partials/sidebar.blade.php diff --git a/templates/search.blade.php b/resources/views/search.blade.php similarity index 100% rename from templates/search.blade.php rename to resources/views/search.blade.php diff --git a/templates/single.blade.php b/resources/views/single.blade.php similarity index 100% rename from templates/single.blade.php rename to resources/views/single.blade.php diff --git a/templates/template-custom.blade.php b/resources/views/template-custom.blade.php similarity index 100% rename from templates/template-custom.blade.php rename to resources/views/template-custom.blade.php diff --git a/src/filters.php b/src/filters.php index da4bbe802b..3dfc20a75a 100644 --- a/src/filters.php +++ b/src/filters.php @@ -35,7 +35,7 @@ add_filter("{$type}_template_hierarchy", function ($templates) { return call_user_func_array('array_merge', array_map(function ($template) { $transforms = [ - '%^/?(templates)?/?%' => config('sage.disable_option_hack') ? 'templates/' : '', + '%^/?(resources/views)?/?%' => config('sage.disable_option_hack') ? 'resources/views/' : '', '%(\.blade)?(\.php)?$%' => '' ]; $normalizedTemplate = preg_replace(array_keys($transforms), array_values($transforms), $template); @@ -44,7 +44,7 @@ }); }, [ 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'home', - 'frontpage', 'page', 'paged', 'search', 'single', 'singular', 'attachment' + 'front_page', 'page', 'paged', 'search', 'single', 'singular', 'attachment' ]); /** diff --git a/src/setup.php b/src/setup.php index 27a071c43c..2a93df2143 100644 --- a/src/setup.php +++ b/src/setup.php @@ -111,10 +111,12 @@ 'uri.stylesheet' => get_stylesheet_directory_uri(), 'uri.template' => get_template_directory_uri(), ]; - $viewPaths = collect(preg_replace('%[\/]?(templates)?[\/.]*?$%', '', [STYLESHEETPATH, TEMPLATEPATH])) + $viewPaths = collect(preg_replace('%[\/]?(resources/views)?[\/.]*?$%', '', [STYLESHEETPATH, TEMPLATEPATH])) ->flatMap(function ($path) { - return ["{$path}/templates", $path]; + return ["{$path}/resources/views", $path]; })->unique()->toArray(); + + // die(var_dump($viewPaths)); config([ 'assets.manifest' => "{$paths['dir.stylesheet']}/dist/assets.json", 'assets.uri' => "{$paths['uri.stylesheet']}/dist", From c3e6f1324e3964f875b1fd9a424baa868cb32341 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Mon, 3 Apr 2017 18:33:06 -0600 Subject: [PATCH 3/4] assets/ -> resources/assets/ --- CHANGELOG.md | 2 +- package.json | 10 ++++---- {assets => resources/assets}/build/.eslintrc | 0 {assets => resources/assets}/build/config.js | 2 +- .../assets}/build/public-path.js | 0 .../assets}/build/util/addHotMiddleware.js | 0 .../build/util/assetManifestsFormatter.js | 0 .../assets}/build/webpack.config.js | 0 .../assets}/build/webpack.config.optimize.js | 0 .../assets}/build/webpack.config.watch.js | 0 {assets => resources/assets}/config.json | 2 +- {assets => resources/assets}/fonts/.gitkeep | 0 {assets => resources/assets}/images/.gitkeep | 0 .../assets}/scripts/customizer.js | 0 {assets => resources/assets}/scripts/main.js | 0 .../assets}/scripts/routes/about.js | 0 .../assets}/scripts/routes/common.js | 0 .../assets}/scripts/routes/home.js | 0 .../assets}/scripts/util/Router.js | 0 .../assets}/scripts/util/camelCase.js | 0 .../assets}/styles/common/_global.scss | 0 .../assets}/styles/common/_variables.scss | 0 .../assets}/styles/components/_buttons.scss | 0 .../assets}/styles/components/_comments.scss | 0 .../assets}/styles/components/_forms.scss | 0 .../styles/components/_wp-classes.scss | 0 .../assets}/styles/layouts/_footer.scss | 0 .../assets}/styles/layouts/_header.scss | 0 .../assets}/styles/layouts/_pages.scss | 0 .../assets}/styles/layouts/_posts.scss | 0 .../assets}/styles/layouts/_sidebar.scss | 0 .../assets}/styles/layouts/_tinymce.scss | 0 {assets => resources/assets}/styles/main.scss | 0 src/lib/Sage/PostCreateProject.php | 24 +++++++++---------- src/setup.php | 2 +- 35 files changed, 21 insertions(+), 21 deletions(-) rename {assets => resources/assets}/build/.eslintrc (100%) rename {assets => resources/assets}/build/config.js (96%) rename {assets => resources/assets}/build/public-path.js (100%) rename {assets => resources/assets}/build/util/addHotMiddleware.js (100%) rename {assets => resources/assets}/build/util/assetManifestsFormatter.js (100%) rename {assets => resources/assets}/build/webpack.config.js (100%) rename {assets => resources/assets}/build/webpack.config.optimize.js (100%) rename {assets => resources/assets}/build/webpack.config.watch.js (100%) rename {assets => resources/assets}/config.json (91%) rename {assets => resources/assets}/fonts/.gitkeep (100%) rename {assets => resources/assets}/images/.gitkeep (100%) rename {assets => resources/assets}/scripts/customizer.js (100%) rename {assets => resources/assets}/scripts/main.js (100%) rename {assets => resources/assets}/scripts/routes/about.js (100%) rename {assets => resources/assets}/scripts/routes/common.js (100%) rename {assets => resources/assets}/scripts/routes/home.js (100%) rename {assets => resources/assets}/scripts/util/Router.js (100%) rename {assets => resources/assets}/scripts/util/camelCase.js (100%) rename {assets => resources/assets}/styles/common/_global.scss (100%) rename {assets => resources/assets}/styles/common/_variables.scss (100%) rename {assets => resources/assets}/styles/components/_buttons.scss (100%) rename {assets => resources/assets}/styles/components/_comments.scss (100%) rename {assets => resources/assets}/styles/components/_forms.scss (100%) rename {assets => resources/assets}/styles/components/_wp-classes.scss (100%) rename {assets => resources/assets}/styles/layouts/_footer.scss (100%) rename {assets => resources/assets}/styles/layouts/_header.scss (100%) rename {assets => resources/assets}/styles/layouts/_pages.scss (100%) rename {assets => resources/assets}/styles/layouts/_posts.scss (100%) rename {assets => resources/assets}/styles/layouts/_sidebar.scss (100%) rename {assets => resources/assets}/styles/layouts/_tinymce.scss (100%) rename {assets => resources/assets}/styles/main.scss (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d485705b..3fe7eb2208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ### HEAD -* Move `templates/` to `resources/views/`, rename `base.blade.php` to `app.blade.php`, ([#1864](https://github.com/roots/sage/pull/1864)) +* Move `templates/` to `resources/views/`, move `assets/` to `resources/assets/`, rename `base.blade.php` to `app.blade.php` ([#1864](https://github.com/roots/sage/pull/1864)) * Add option to configure build settings ([#1822](https://github.com/roots/sage/pull/1822)) * Add support for HTML injection ([#1817](https://github.com/roots/sage/pull/1817)) diff --git a/package.json b/package.json index f49f25f23f..647a3b64b4 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,12 @@ } ], "scripts": { - "build": "webpack --progress --config assets/build/webpack.config.js", - "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", + "build": "webpack --progress --config resources/assets/build/webpack.config.js", + "build:production": "webpack --progress -p --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", - "lint": "eslint assets/scripts assets/build", + "lint": "eslint resources/assets/scripts resources/assets/build", "test": "yarn run lint" }, "engines": { diff --git a/assets/build/.eslintrc b/resources/assets/build/.eslintrc similarity index 100% rename from assets/build/.eslintrc rename to resources/assets/build/.eslintrc diff --git a/assets/build/config.js b/resources/assets/build/config.js similarity index 96% rename from assets/build/config.js rename to resources/assets/build/config.js index fcb021b582..9ef5827c8a 100644 --- a/assets/build/config.js +++ b/resources/assets/build/config.js @@ -15,7 +15,7 @@ const config = merge({ cacheBusting: '[name]_[hash]', paths: { root: rootPath, - assets: path.join(rootPath, 'assets'), + assets: path.join(rootPath, 'resources/assets'), dist: path.join(rootPath, 'dist'), }, enabled: { diff --git a/assets/build/public-path.js b/resources/assets/build/public-path.js similarity index 100% rename from assets/build/public-path.js rename to resources/assets/build/public-path.js diff --git a/assets/build/util/addHotMiddleware.js b/resources/assets/build/util/addHotMiddleware.js similarity index 100% rename from assets/build/util/addHotMiddleware.js rename to resources/assets/build/util/addHotMiddleware.js diff --git a/assets/build/util/assetManifestsFormatter.js b/resources/assets/build/util/assetManifestsFormatter.js similarity index 100% rename from assets/build/util/assetManifestsFormatter.js rename to resources/assets/build/util/assetManifestsFormatter.js diff --git a/assets/build/webpack.config.js b/resources/assets/build/webpack.config.js similarity index 100% rename from assets/build/webpack.config.js rename to resources/assets/build/webpack.config.js diff --git a/assets/build/webpack.config.optimize.js b/resources/assets/build/webpack.config.optimize.js similarity index 100% rename from assets/build/webpack.config.optimize.js rename to resources/assets/build/webpack.config.optimize.js diff --git a/assets/build/webpack.config.watch.js b/resources/assets/build/webpack.config.watch.js similarity index 100% rename from assets/build/webpack.config.watch.js rename to resources/assets/build/webpack.config.watch.js diff --git a/assets/config.json b/resources/assets/config.json similarity index 91% rename from assets/config.json rename to resources/assets/config.json index 0b0bdd8080..cce31fa51c 100644 --- a/assets/config.json +++ b/resources/assets/config.json @@ -13,7 +13,7 @@ "proxyUrl": "http://localhost:3000", "cacheBusting": "[name]_[hash:8]", "watch": [ - "{src,templates}/**/*.php" + "{src,resources/views}/**/*.php" ], "browsers": [ "last 2 versions", diff --git a/assets/fonts/.gitkeep b/resources/assets/fonts/.gitkeep similarity index 100% rename from assets/fonts/.gitkeep rename to resources/assets/fonts/.gitkeep diff --git a/assets/images/.gitkeep b/resources/assets/images/.gitkeep similarity index 100% rename from assets/images/.gitkeep rename to resources/assets/images/.gitkeep diff --git a/assets/scripts/customizer.js b/resources/assets/scripts/customizer.js similarity index 100% rename from assets/scripts/customizer.js rename to resources/assets/scripts/customizer.js diff --git a/assets/scripts/main.js b/resources/assets/scripts/main.js similarity index 100% rename from assets/scripts/main.js rename to resources/assets/scripts/main.js diff --git a/assets/scripts/routes/about.js b/resources/assets/scripts/routes/about.js similarity index 100% rename from assets/scripts/routes/about.js rename to resources/assets/scripts/routes/about.js diff --git a/assets/scripts/routes/common.js b/resources/assets/scripts/routes/common.js similarity index 100% rename from assets/scripts/routes/common.js rename to resources/assets/scripts/routes/common.js diff --git a/assets/scripts/routes/home.js b/resources/assets/scripts/routes/home.js similarity index 100% rename from assets/scripts/routes/home.js rename to resources/assets/scripts/routes/home.js diff --git a/assets/scripts/util/Router.js b/resources/assets/scripts/util/Router.js similarity index 100% rename from assets/scripts/util/Router.js rename to resources/assets/scripts/util/Router.js diff --git a/assets/scripts/util/camelCase.js b/resources/assets/scripts/util/camelCase.js similarity index 100% rename from assets/scripts/util/camelCase.js rename to resources/assets/scripts/util/camelCase.js diff --git a/assets/styles/common/_global.scss b/resources/assets/styles/common/_global.scss similarity index 100% rename from assets/styles/common/_global.scss rename to resources/assets/styles/common/_global.scss diff --git a/assets/styles/common/_variables.scss b/resources/assets/styles/common/_variables.scss similarity index 100% rename from assets/styles/common/_variables.scss rename to resources/assets/styles/common/_variables.scss diff --git a/assets/styles/components/_buttons.scss b/resources/assets/styles/components/_buttons.scss similarity index 100% rename from assets/styles/components/_buttons.scss rename to resources/assets/styles/components/_buttons.scss diff --git a/assets/styles/components/_comments.scss b/resources/assets/styles/components/_comments.scss similarity index 100% rename from assets/styles/components/_comments.scss rename to resources/assets/styles/components/_comments.scss diff --git a/assets/styles/components/_forms.scss b/resources/assets/styles/components/_forms.scss similarity index 100% rename from assets/styles/components/_forms.scss rename to resources/assets/styles/components/_forms.scss diff --git a/assets/styles/components/_wp-classes.scss b/resources/assets/styles/components/_wp-classes.scss similarity index 100% rename from assets/styles/components/_wp-classes.scss rename to resources/assets/styles/components/_wp-classes.scss diff --git a/assets/styles/layouts/_footer.scss b/resources/assets/styles/layouts/_footer.scss similarity index 100% rename from assets/styles/layouts/_footer.scss rename to resources/assets/styles/layouts/_footer.scss diff --git a/assets/styles/layouts/_header.scss b/resources/assets/styles/layouts/_header.scss similarity index 100% rename from assets/styles/layouts/_header.scss rename to resources/assets/styles/layouts/_header.scss diff --git a/assets/styles/layouts/_pages.scss b/resources/assets/styles/layouts/_pages.scss similarity index 100% rename from assets/styles/layouts/_pages.scss rename to resources/assets/styles/layouts/_pages.scss diff --git a/assets/styles/layouts/_posts.scss b/resources/assets/styles/layouts/_posts.scss similarity index 100% rename from assets/styles/layouts/_posts.scss rename to resources/assets/styles/layouts/_posts.scss diff --git a/assets/styles/layouts/_sidebar.scss b/resources/assets/styles/layouts/_sidebar.scss similarity index 100% rename from assets/styles/layouts/_sidebar.scss rename to resources/assets/styles/layouts/_sidebar.scss diff --git a/assets/styles/layouts/_tinymce.scss b/resources/assets/styles/layouts/_tinymce.scss similarity index 100% rename from assets/styles/layouts/_tinymce.scss rename to resources/assets/styles/layouts/_tinymce.scss diff --git a/assets/styles/main.scss b/resources/assets/styles/main.scss similarity index 100% rename from assets/styles/main.scss rename to resources/assets/styles/main.scss diff --git a/src/lib/Sage/PostCreateProject.php b/src/lib/Sage/PostCreateProject.php index d7583cbd9e..0dac4fccb9 100755 --- a/src/lib/Sage/PostCreateProject.php +++ b/src/lib/Sage/PostCreateProject.php @@ -41,10 +41,10 @@ public static function selectFramework(Event $event) $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', + 'resources/assets/styles/components/_comments.scss', + 'resources/assets/styles/components/_forms.scss', + 'resources/assets/styles/components/_wp-classes.scss', + 'resources/assets/styles/layouts/_header.scss', ]; @@ -61,16 +61,16 @@ public static function selectFramework(Event $event) 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'))); + file_put_contents('resources/assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '@import "~foundation-sites/scss/foundation";' . "\n" . '@include foundation-everything;' . "\n", file_get_contents('resources/assets/styles/main.scss'))); + file_put_contents('resources/assets/scripts/main.js', str_replace("import 'bootstrap';\n", "import 'foundation-sites/dist/js/foundation';\n", file_get_contents('resources/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'))); + file_put_contents('resources/assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '', file_get_contents('resources/assets/styles/main.scss'))); + file_put_contents('resources/assets/scripts/main.js', str_replace("import 'bootstrap';\n", '', file_get_contents('resources/assets/scripts/main.js'))); foreach($files_to_clear as $file) { file_put_contents($file, ''); } @@ -93,8 +93,8 @@ public static function addFontAwesome(Event $event) file_put_contents('package.json', $package); $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); + file_put_contents('resources/assets/styles/main.scss', str_replace($import_dep_str, $import_dep_str . '@import "~font-awesome/scss/font-awesome";' . "\n", file_get_contents('resources/assets/styles/main.scss'))); + file_put_contents('resources/assets/styles/common/_variables.scss', "\n" . '$fa-font-path: \'~font-awesome/fonts\';' . "\n", FILE_APPEND); } } } @@ -116,8 +116,8 @@ public static function buildOptions(Event $event) 'devUrl' => $io->ask('Local development URL of WP site ['.$browsersync_settings_default['devUrl'].']: ', $browsersync_settings_default['devUrl']) ]; - file_put_contents('assets/config.json', str_replace('/app/themes/sage', $browsersync_settings['publicPath'], file_get_contents('assets/config.json'))); - file_put_contents('assets/config.json', str_replace($browsersync_settings_default['devUrl'], $browsersync_settings['devUrl'], file_get_contents('assets/config.json'))); + file_put_contents('resources/assets/config.json', str_replace('/app/themes/sage', $browsersync_settings['publicPath'], file_get_contents('resources/assets/config.json'))); + file_put_contents('resources/assets/config.json', str_replace($browsersync_settings_default['devUrl'], $browsersync_settings['devUrl'], file_get_contents('resources/assets/config.json'))); } } // @codingStandardsIgnoreEnd diff --git a/src/setup.php b/src/setup.php index 2a93df2143..549f44f2bf 100644 --- a/src/setup.php +++ b/src/setup.php @@ -64,7 +64,7 @@ /** * Use main stylesheet for visual editor - * @see assets/styles/layouts/_tinymce.scss + * @see resources/assets/styles/layouts/_tinymce.scss */ add_editor_style(asset_path('styles/main.css')); }, 20); From 5ac56aadf2f00f8ba30ade31f0c4bdf9bc69d878 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Mon, 3 Apr 2017 18:49:09 -0600 Subject: [PATCH 4/4] Fix redirect loop --- functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions.php b/functions.php index 07e0b40df1..3329747f88 100644 --- a/functions.php +++ b/functions.php @@ -80,8 +80,8 @@ add_filter('template', function ($stylesheet) { return dirname(dirname($stylesheet)); }); -if (basename($stylesheet = get_option('template')) !== 'resources/views') { - update_option('template', "{$stylesheet}/resources/views"); +if (($sage_views = basename(__DIR__).'/resources/views') !== get_option('template')) { + update_option('template', $sage_views); wp_redirect($_SERVER['REQUEST_URI']); exit(); }