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 0d15cd5..9c48803 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/book.blade.php b/resources/views/partials/book.blade.php index f0e1f7d..0562c54 100644 --- a/resources/views/partials/book.blade.php +++ b/resources/views/partials/book.blade.php @@ -1,6 +1,6 @@
@if(isset($book['metadata']['keywords'])) 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 @@