File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 47
47
48
48
if ($ result ->isSuccessful ()) {
49
49
// fix assets URLs to make them absolute (otherwise, they don't work in subdirectories)
50
- foreach (glob ($ outputDir .'/**/*.html ' ) as $ htmlFilePath ) {
50
+ $ iterator = new RecursiveIteratorIterator (new RecursiveDirectoryIterator ($ outputDir ));
51
+
52
+ foreach (new RegexIterator ($ iterator , '/^.+\.html$/i ' , RegexIterator::GET_MATCH ) as $ match ) {
53
+ $ htmlFilePath = array_shift ($ match );
54
+ $ htmlContents = file_get_contents ($ htmlFilePath );
55
+ file_put_contents ($ htmlFilePath , str_replace ('<head> ' , '<head><base href="/"> ' , $ htmlContents ));
56
+ }
57
+
58
+ foreach (new RegexIterator ($ iterator , '/^.+\.css/i ' , RegexIterator::GET_MATCH ) as $ match ) {
59
+ $ htmlFilePath = array_shift ($ match );
51
60
$ htmlContents = file_get_contents ($ htmlFilePath );
52
- file_put_contents ($ htmlFilePath , str_replace ('href="assets / ' , 'href="/assets / ' , $ htmlContents ));
61
+ file_put_contents ($ htmlFilePath , str_replace ('fonts / ' , '../fonts / ' , $ htmlContents ));
53
62
}
54
63
55
64
$ io ->success (sprintf ("The Symfony Docs were successfully built at %s " , realpath ($ outputDir )));
You can’t perform that action at this time.
0 commit comments