Skip to content

Commit 028acc7

Browse files
authored
Merge pull request #5832 from Laravel-Backpack/map-the-ui-assets
map the ui files
2 parents c7ebf3a + da9be6b commit 028acc7

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/BackpackServiceProvider.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,26 @@ public function boot(Router $router)
6363
$this->sendUsageStats();
6464

6565
Basset::addViewPath(realpath(__DIR__.'/resources/views'));
66+
67+
foreach (config('backpack.ui.styles', []) as $style) {
68+
if (is_array($style)) {
69+
foreach ($style as $file) {
70+
Basset::map($file);
71+
}
72+
} else {
73+
Basset::map($style);
74+
}
75+
}
76+
77+
foreach (config('backpack.ui.scripts', []) as $script) {
78+
if (is_array($script)) {
79+
foreach ($script as $file) {
80+
Basset::map($file);
81+
}
82+
} else {
83+
Basset::map($script);
84+
}
85+
}
6686
}
6787

6888
/**

src/ThemeServiceProvider.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ public function loadViews()
9292

9393
// Add basset view path
9494
Basset::addViewPath($this->packageViewsPath());
95+
96+
foreach (config($this->vendorNameDotPackageName().'.styles', []) as $path) {
97+
if (is_array($path)) {
98+
foreach ($path as $style) {
99+
Basset::map($style, $style);
100+
}
101+
} else {
102+
Basset::map($path, $path);
103+
}
104+
}
105+
106+
foreach (config($this->vendorNameDotPackageName().'.scripts', []) as $path) {
107+
if (is_array($path)) {
108+
foreach ($path as $script) {
109+
Basset::map($script, $script);
110+
}
111+
} else {
112+
Basset::map($path, $path);
113+
}
114+
}
95115
}
96116

97117
/**

0 commit comments

Comments
 (0)