Use a constant for the build directory path

Ref #1352
This commit is contained in:
Ben Word
2015-03-03 14:37:47 -06:00
parent 0c25df7e09
commit a57e07b14a
2 changed files with 8 additions and 4 deletions

View File

@@ -53,14 +53,13 @@ class JsonManifest {
} }
function asset_path($filename) { 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) . '/'; $directory = dirname($filename) . '/';
$file = basename($filename); $file = basename($filename);
static $manifest; static $manifest;
if (empty($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); $manifest = new JsonManifest($manifest_path);
} }
@@ -131,7 +130,7 @@ function jquery_local_fallback($src, $handle = null) {
static $add_jquery_fallback = false; static $add_jquery_fallback = false;
if ($add_jquery_fallback) { if ($add_jquery_fallback) {
echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . $dist_dir . 'scripts/jquery.js"><\/script>\')</script>' . "\n"; echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . DIST_DIR . 'scripts/jquery.js"><\/script>\')</script>' . "\n";
$add_jquery_fallback = false; $add_jquery_fallback = false;
} }

View File

@@ -27,6 +27,11 @@ if (!defined('WP_ENV')) {
define('WP_ENV', 'production'); 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 * Define which pages shouldn't have the sidebar
*/ */