From 11713f1ec880f43f9ce60301842a207413fa4162 Mon Sep 17 00:00:00 2001 From: Daniel Olson Date: Thu, 26 Feb 2015 16:39:53 -0500 Subject: [PATCH 1/3] Handle $dist_path as var Based on this thread: https://discourse.roots.io/t/sage-and-augmenting-my-workflow/2965/3 This sets up the opportunity to change the path of `dist/` for those needing to reference a different build. --- lib/assets.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/assets.php b/lib/assets.php index c090cfb5e5..ed2dcfbfe5 100644 --- a/lib/assets.php +++ b/lib/assets.php @@ -59,7 +59,7 @@ function asset_path($filename) { static $manifest; if (empty($manifest)) { - $manifest_path = get_template_directory() . '/dist/assets.json'; + $manifest_path = get_template_directory() . $dist_path . 'assets.json'; $manifest = new JsonManifest($manifest_path); } @@ -130,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; } @@ -171,4 +171,3 @@ function ga() { if (GOOGLE_ANALYTICS_ID) { add_action('wp_footer', __NAMESPACE__ . '\\google_analytics', 20); } - From c64d70f1bb6b064a46f362548e1dc21a7f757ee9 Mon Sep 17 00:00:00 2001 From: Daniel Olson Date: Thu, 26 Feb 2015 17:32:53 -0500 Subject: [PATCH 2/3] Corrected $dist_path var --- lib/assets.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/assets.php b/lib/assets.php index ed2dcfbfe5..7617ce86ad 100644 --- a/lib/assets.php +++ b/lib/assets.php @@ -53,13 +53,14 @@ public function getPath($key = '', $default = null) { } function asset_path($filename) { - $dist_path = get_template_directory_uri() . '/dist/'; + $dist_var = '/dist/'; + $dist_path = get_template_directory_uri() . $dist_var; $directory = dirname($filename) . '/'; $file = basename($filename); static $manifest; if (empty($manifest)) { - $manifest_path = get_template_directory() . $dist_path . 'assets.json'; + $manifest_path = get_template_directory() . $dist_var . 'assets.json'; $manifest = new JsonManifest($manifest_path); } @@ -130,7 +131,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; } From 12d0f21e03b47e9696d8ba0305cbe5570fb4631d Mon Sep 17 00:00:00 2001 From: Austin Pray Date: Thu, 26 Feb 2015 17:07:31 -0600 Subject: [PATCH 3/3] dist_var -> dist_dir --- lib/assets.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/assets.php b/lib/assets.php index 7617ce86ad..775798c08c 100644 --- a/lib/assets.php +++ b/lib/assets.php @@ -53,14 +53,14 @@ public function getPath($key = '', $default = null) { } function asset_path($filename) { - $dist_var = '/dist/'; - $dist_path = get_template_directory_uri() . $dist_var; + $dist_dir = '/dist/'; + $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_var . 'assets.json'; + $manifest_path = get_template_directory() . $dist_dir . 'assets.json'; $manifest = new JsonManifest($manifest_path); } @@ -131,7 +131,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; }