File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1515 */
1616 function mix ($ path )
1717 {
18+ $ kirby = kirby ();
19+
1820 // Handle arrays
1921 if (is_array ($ path )) {
2022 $ assets = [];
@@ -72,7 +74,7 @@ function mix($path)
7274 }
7375 }
7476
75- $ path = '/ ' .$ type .'/templates/ ' .kirby () ->site ()->page ()->intendedTemplate ().'. ' .$ type ;
77+ $ path = '/ ' .$ type .'/templates/ ' .$ kirby ->site ()->page ()->intendedTemplate ().'. ' .$ type ;
7678 }
7779
7880 // Check if the manifest contains the given $path
@@ -84,8 +86,18 @@ function mix($path)
8486 }
8587 }
8688
89+ // Check if Mix is in hmr mode
90+ $ mixHmrFile = $ kirby ->root ('index ' ) . $ assetsDirectory . '/hot ' ;
91+
8792 // Get the actual file path for the given $path
88- $ mixFilePath = $ assetsDirectory . $ manifest [$ path ];
93+ if (F::exists ($ mixHmrFile )) {
94+ // Remove white space from string and remove ending forward slash
95+ $ hmrHost = preg_replace ('/\s+/ ' , '' , F::read ($ mixHmrFile ));
96+ $ hmrHost = substr ($ hmrHost , 0 , -1 );
97+ $ mixFilePath = $ hmrHost . $ manifest [$ path ];
98+ } else {
99+ $ mixFilePath = $ assetsDirectory . $ manifest [$ path ];
100+ }
89101
90102 // Use the appropriate Kirby helper method to get the correct HTML tag
91103 $ pathExtension = F::extension ($ mixFilePath );
You can’t perform that action at this time.
0 commit comments