From a57e07b14a4b657059438565098caa7bc901adbe Mon Sep 17 00:00:00 2001 From: Ben Word Date: Tue, 3 Mar 2015 14:37:47 -0600 Subject: [PATCH] Use a constant for the build directory path Ref #1352 --- lib/assets.php | 7 +++---- lib/config.php | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/assets.php b/lib/assets.php index 775798c08c..70af392904 100644 --- a/lib/assets.php +++ b/lib/assets.php @@ -53,14 +53,13 @@ public function getPath($key = '', $default = null) { } function asset_path($filename) { - $dist_dir = '/dist/'; - $dist_path = get_template_directory_uri() . $dist_dir; + $dist_path = get_template_directory_uri() . DIST_DIR; $directory = dirname($filename) . '/'; $file = basename($filename); static $manifest; if (empty($manifest)) { - $manifest_path = get_template_directory() . $dist_dir . 'assets.json'; + $manifest_path = get_template_directory() . DIST_DIR . 'assets.json'; $manifest = new JsonManifest($manifest_path); } @@ -131,7 +130,7 @@ function jquery_local_fallback($src, $handle = null) { static $add_jquery_fallback = false; if ($add_jquery_fallback) { - echo '' . "\n"; + echo '' . "\n"; $add_jquery_fallback = false; } diff --git a/lib/config.php b/lib/config.php index 46d3c7c0c8..d5ffad2c91 100644 --- a/lib/config.php +++ b/lib/config.php @@ -27,6 +27,11 @@ define('WP_ENV', 'production'); } +if (!defined('DIST_DIR')) { + // Path to the build directory for front-end assets + define('DIST_DIR', '/dist/'); +} + /** * Define which pages shouldn't have the sidebar */