@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user