From abff9583759af3c73a6bfaa7153028aa68488c8e Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Mon, 11 Sep 2017 14:07:00 -0300 Subject: [PATCH 1/3] Fix catalog. --- resources/views/front-page.blade.php | 24 ++++++++++++++++++- .../partials/front-page-catalog.blade.php | 15 ------------ 2 files changed, 23 insertions(+), 16 deletions(-) delete mode 100644 resources/views/partials/front-page-catalog.blade.php diff --git a/resources/views/front-page.blade.php b/resources/views/front-page.blade.php index 231c5bc..f4090b5 100644 --- a/resources/views/front-page.blade.php +++ b/resources/views/front-page.blade.php @@ -19,7 +19,29 @@ @endcomponent @endif @if(get_option('pb_front_page_catalog')) - @include('partials.front-page-catalog') +
+

{{ $latest_books_title }}

+
+
+ @foreach($catalog_data['books'] as $book) + @include('partials.book', ['book' => $book]) + @endforeach +
+ @if($previous_page) + + @endif + @if($next_page <= $catalog_data['pages']) + + @endif +
+ +
@endif @endsection diff --git a/resources/views/partials/front-page-catalog.blade.php b/resources/views/partials/front-page-catalog.blade.php deleted file mode 100644 index 2643d8f..0000000 --- a/resources/views/partials/front-page-catalog.blade.php +++ /dev/null @@ -1,15 +0,0 @@ -
-

{{ $latest_books_title }}

-
-
- @foreach($catalog_data['books'] as $book) - @include('partials.book', ['book' => $book]) - @endforeach -
- @if($previous_page)@endif - @if($next_page <= $catalog_data['pages'])@endif -
- -
From 8a16c2d74296114ef73f80363fdf3b2302938663 Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Mon, 11 Sep 2017 20:24:33 -0300 Subject: [PATCH 2/3] Update license structure in metadata for Pressbooks 4.3. --- resources/views/partials/book.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/partials/book.blade.php b/resources/views/partials/book.blade.php index 45fefcb..0b9738b 100644 --- a/resources/views/partials/book.blade.php +++ b/resources/views/partials/book.blade.php @@ -1,6 +1,6 @@
@if(isset($book['metadata']['keywords'])) From df7dab3ed53354267f860ec48670562e34578daa Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Mon, 11 Sep 2017 21:09:19 -0300 Subject: [PATCH 3/3] Use Laravel Mix (#9) --- app/controllers/App.php | 2 +- app/helpers.php | 11 +- config/assets.php | 2 +- package.json | 46 +- .../assets/styles/autoload/_tachyons.scss | 4 - resources/assets/styles/login.scss | 0 resources/assets/styles/main.scss | 4 +- resources/views/front-page.blade.php | 4 +- resources/views/page-catalog.blade.php | 4 +- resources/views/partials/footer.blade.php | 2 +- webpack.mix.js | 73 + yarn.lock | 2649 +++++++++++------ 12 files changed, 1804 insertions(+), 997 deletions(-) delete mode 100644 resources/assets/styles/autoload/_tachyons.scss create mode 100644 resources/assets/styles/login.scss create mode 100644 webpack.mix.js diff --git a/app/controllers/App.php b/app/controllers/App.php index ef82d2d..419d5ce 100644 --- a/app/controllers/App.php +++ b/app/controllers/App.php @@ -12,7 +12,7 @@ class App extends Controller if (has_custom_logo()) { return wp_get_attachment_image($custom_logo_id, 'original'); } else { - return file_get_contents(get_theme_file_path() . '/dist/' . svg_path('images/logo.svg')); + return file_get_contents(get_theme_file_path() . '/dist/' . asset_dir('images/logo.svg')); } } diff --git a/app/helpers.php b/app/helpers.php index 442f2f3..b89c869 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -76,16 +76,16 @@ function template_path($file, $data = []) */ function asset_path($asset) { - return sage('assets')->getUri($asset); + return fix_path(sage('assets')->getUri('/' . $asset)); } /** * @param $asset * @return string */ -function svg_path($asset) +function asset_dir($asset) { - return sage('assets')->get($asset); + return fix_path(sage('assets')->get('/' . $asset)); } /** @@ -195,3 +195,8 @@ function contact_form_submission() } return false; } + +function fix_path($path) +{ + return str_replace('/dist//', '/dist/', $path); +} diff --git a/config/assets.php b/config/assets.php index 314b0cd..979ea49 100644 --- a/config/assets.php +++ b/config/assets.php @@ -14,7 +14,7 @@ return [ | */ - 'manifest' => get_theme_file_path().'/dist/assets.json', + 'manifest' => get_theme_file_path().'/dist/mix-manifest.json', /* |-------------------------------------------------------------------------- diff --git a/package.json b/package.json index fef2d7c..5da3e4c 100644 --- a/package.json +++ b/package.json @@ -75,56 +75,32 @@ } }, "scripts": { - "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", + "build": "cross-env NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "build:production": "cross-env NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "build:profile": "cross-env NODE_ENV=production webpack --progress --profile --json --config=node_modules/laravel-mix/setup/webpack.config.js", + "start": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "rmdist": "rimraf dist", "lint": "npm run -s lint:scripts && npm run -s lint:styles", - "lint:scripts": "eslint resources/assets/scripts resources/assets/build", - "lint:styles": "stylelint 'resources/assets/styles/**/*.{css,sass,scss,sss,less}'", + "lint:scripts": "eslint \"resources/assets/scripts\"", + "lint:styles": "stylelint \"resources/assets/styles/**/*.scss\"", "test": "npm run -s lint" }, "engines": { "node": ">= 6.9.4" }, "devDependencies": { - "autoprefixer": "~7.1", - "browser-sync": "~2.18", - "browsersync-webpack-plugin": "^0.6.0", - "bs-html-injector": "~3.0", - "buble-loader": "^0.4.1", - "cache-loader": "~1.0", - "clean-webpack-plugin": "^0.1.16", - "copy-globs-webpack-plugin": "^0.2.0", - "css-loader": "^0.28.4", - "cssnano": "~4.0.0-rc.1", + "browser-sync": "^2.18.13", + "browser-sync-webpack-plugin": "^1.2.0", + "cross-env": "*", "eslint": "~4.2", "eslint-loader": "~1.9", "eslint-plugin-import": "~2.7", "extract-text-webpack-plugin": "~3.0", - "file-loader": "^0.11.2", - "friendly-errors-webpack-plugin": "^1.6.1", - "imagemin-mozjpeg": "~6.0", - "imagemin-webpack-plugin": "~1.5.0-beta.0", - "import-glob": "~1.5", - "node-sass": "~4.5", - "postcss-loader": "~2.0", - "postcss-safe-parser": "~3.0", - "resolve-url-loader": "~2.1", + "laravel-mix": "~1.4", "rimraf": "~2.6", - "sass-loader": "~6.0", - "style-loader": "^0.18.2", "stylelint": "~7.12", "stylelint-config-standard": "~16.0", - "stylelint-webpack-plugin": "^0.8.0", - "url-loader": "^0.5.9", - "webpack": "~3.3", - "webpack-assets-manifest": "^0.7.0", - "webpack-dev-middleware": "~1.11", - "webpack-hot-middleware": "~2.18", - "webpack-merge": "~4.1", - "yargs": "~8.0" + "stylelint-webpack-plugin": "^0.8.0" }, "dependencies": { "isotope-layout": "^3.0.4", diff --git a/resources/assets/styles/autoload/_tachyons.scss b/resources/assets/styles/autoload/_tachyons.scss deleted file mode 100644 index 6ab7ab2..0000000 --- a/resources/assets/styles/autoload/_tachyons.scss +++ /dev/null @@ -1,4 +0,0 @@ -// `sage preset` installed this file automatically. -// Running `sage preset` again could result in automatic deletion of this file. -// Because of this, we do not recommend editing this file. -@import "~tachyons-sass/tachyons"; diff --git a/resources/assets/styles/login.scss b/resources/assets/styles/login.scss new file mode 100644 index 0000000..e69de29 diff --git a/resources/assets/styles/main.scss b/resources/assets/styles/main.scss index 38991a2..4441e9c 100644 --- a/resources/assets/styles/main.scss +++ b/resources/assets/styles/main.scss @@ -1,14 +1,12 @@ @import "common/variables"; -/** Import everything from autoload */ -@import "./autoload/**/*"; - /** * Import npm dependencies * * Prefix your imports with `~` to grab from node_modules/ * @see https://github.com/webpack-contrib/sass-loader#imports */ +@import "~tachyons-sass/tachyons"; /** Import theme styles */ @import "common/functions"; diff --git a/resources/views/front-page.blade.php b/resources/views/front-page.blade.php index f4090b5..00730cf 100644 --- a/resources/views/front-page.blade.php +++ b/resources/views/front-page.blade.php @@ -29,12 +29,12 @@
@if($previous_page) @endif @if($next_page <= $catalog_data['pages']) @endif diff --git a/resources/views/page-catalog.blade.php b/resources/views/page-catalog.blade.php index fbb9baa..8a65c8f 100644 --- a/resources/views/page-catalog.blade.php +++ b/resources/views/page-catalog.blade.php @@ -50,7 +50,7 @@ @if($catalog_data['pages'] > 1) @endif diff --git a/resources/views/partials/footer.blade.php b/resources/views/partials/footer.blade.php index c4d04f4..6aedce9 100644 --- a/resources/views/partials/footer.blade.php +++ b/resources/views/partials/footer.blade.php @@ -31,7 +31,7 @@