diff --git a/app/helpers.php b/app/helpers.php index 5c11fa5..b56c162 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -21,8 +21,8 @@ function sage($abstract = null, $parameters = [], ContainerContract $container = return $container; } return $container->bound($abstract) - ? $container->make($abstract, $parameters) - : $container->make("sage.{$abstract}", $parameters); + ? $container->makeWith($abstract, $parameters) + : $container->makeWith("sage.{$abstract}", $parameters); } /** diff --git a/app/setup.php b/app/setup.php index 6daee40..3c92a04 100644 --- a/app/setup.php +++ b/app/setup.php @@ -116,7 +116,6 @@ add_action('after_setup_theme', function () { 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", diff --git a/package.json b/package.json index 1efe4e0..363e8ab 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,11 @@ "url": "http://opensource.org/licenses/MIT" } ], + "browserslist": [ + "last 2 versions", + "android 4", + "opera 12" + ], "scripts": { "build": "webpack --progress --config resources/assets/build/webpack.config.js", "build:production": "webpack --progress -p --config resources/assets/build/webpack.config.js", @@ -30,7 +35,7 @@ "node": ">= 6.9.4" }, "devDependencies": { - "autoprefixer": "^6.7.7", + "autoprefixer": "^7.1.1", "browser-sync": "^2.18.8", "browsersync-webpack-plugin": "^0.5.3", "bs-html-injector": "^3.0.3", diff --git a/resources/assets/build/config.js b/resources/assets/build/config.js index 9ef5827..c9a04a1 100644 --- a/resources/assets/build/config.js +++ b/resources/assets/build/config.js @@ -25,7 +25,6 @@ const config = merge({ watcher: !!argv.watch, }, watch: [], - browsers: [], }, userConfig); module.exports = merge(config, { diff --git a/resources/assets/build/webpack.config.js b/resources/assets/build/webpack.config.js index 10c271e..b70e0a9 100644 --- a/resources/assets/build/webpack.config.js +++ b/resources/assets/build/webpack.config.js @@ -142,7 +142,7 @@ let webpackConfig = { output: { path: config.paths.dist }, context: config.paths.assets, postcss: [ - autoprefixer({ browsers: config.browsers }), + autoprefixer(), ], }, }), diff --git a/resources/assets/build/webpack.config.optimize.js b/resources/assets/build/webpack.config.optimize.js index 3b306ab..9480cfc 100644 --- a/resources/assets/build/webpack.config.optimize.js +++ b/resources/assets/build/webpack.config.optimize.js @@ -13,7 +13,8 @@ module.exports = { cssProcessor: cssnano, cssProcessorOptions: { discardComments: { removeAll: true }, - autoprefixer: { browsers: config.browsers }, + autoprefixer: {}, + safe: true, }, canPrint: true, }), diff --git a/resources/assets/config.json b/resources/assets/config.json index 6beda62..4dfdb17 100644 --- a/resources/assets/config.json +++ b/resources/assets/config.json @@ -14,10 +14,5 @@ "cacheBusting": "[name]_[hash:8]", "watch": [ "{app,resources/views}/**/*.php" - ], - "browsers": [ - "last 2 versions", - "android 4", - "opera 12" ] } diff --git a/resources/functions.php b/resources/functions.php index a92aa27..547e6ff 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -59,12 +59,12 @@ array_map(function ($file) use ($sage_error) { /** * Here's what's happening with these hooks: - * 1. WordPress initially detects theme in themes/sage + * 1. WordPress initially detects theme in themes/sage/resources * 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 + * 3. When we call get_template_directory() or get_template_directory_uri(), we point it back to themes/sage/resources * * 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 + * But functions.php, style.css, and index.php are all still located in themes/sage/resources * * This is not compatible with the WordPress Customizer theme preview prior to theme activation * @@ -86,6 +86,9 @@ add_filter('stylesheet_directory_uri', function ($uri) { }); if ($sage_views !== get_option('stylesheet')) { update_option('stylesheet', $sage_views); + if (php_sapi_name() === 'cli') { + return; + } wp_redirect($_SERVER['REQUEST_URI']); exit(); } diff --git a/yarn.lock b/yarn.lock index d5b65c2..526ef22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -264,6 +264,17 @@ autoprefixer@^6.0.0, autoprefixer@^6.3.1, autoprefixer@^6.7.7: postcss "^5.2.16" postcss-value-parser "^3.2.3" +autoprefixer@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-7.1.1.tgz#97bc854c7d0b979f8d6489de547a0d17fb307f6d" + dependencies: + browserslist "^2.1.3" + caniuse-lite "^1.0.30000670" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^6.0.1" + postcss-value-parser "^3.2.3" + aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -542,6 +553,13 @@ browserslist@^1.1.1, browserslist@^1.1.3, browserslist@^1.3.6, browserslist@^1.5 caniuse-db "^1.0.30000639" electron-to-chromium "^1.2.7" +browserslist@^2.1.3: + version "2.1.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.1.4.tgz#cc526af4a1312b7d2e05653e56d0c8ab70c0e053" + dependencies: + caniuse-lite "^1.0.30000670" + electron-to-chromium "^1.3.11" + browsersync-webpack-plugin@^0.5.3: version "0.5.3" resolved "https://registry.yarnpkg.com/browsersync-webpack-plugin/-/browsersync-webpack-plugin-0.5.3.tgz#35bc3b1c5aba8c7d2d7b700e23d511454b8d516e" @@ -691,6 +709,10 @@ caniuse-db@^1.0.30000187, caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, ca version "1.0.30000655" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000655.tgz#e40b6287adc938848d6708ef83d65b5f54ac1874" +caniuse-lite@^1.0.30000670: + version "1.0.30000676" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000676.tgz#1e962123f48073f0c51c4ea0651dd64d25786498" + capture-stack-trace@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d" @@ -1530,6 +1552,10 @@ electron-to-chromium@^1.2.7: version "1.3.3" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.3.tgz#651eb63fe89f39db70ffc8dbd5d9b66958bc6a0e" +electron-to-chromium@^1.3.11: + version "1.3.13" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.13.tgz#1b3a5eace6e087bb5e257a100b0cbfe81b2891fc" + elliptic@^6.0.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" @@ -4411,6 +4437,14 @@ postcss@^5.0.0, postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0. source-map "^0.5.6" supports-color "^3.2.3" +postcss@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.1.tgz#000dbd1f8eef217aa368b9a212c5fc40b2a8f3f2" + dependencies: + chalk "^1.1.3" + source-map "^0.5.6" + supports-color "^3.2.3" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"