|
44 | 44 |
|
45 | 45 | class MaryServiceProvider extends ServiceProvider
|
46 | 46 | {
|
| 47 | + public static $third_party = [ |
| 48 | + 'calendar' => '2.7.0', |
| 49 | + 'currency' => '1.0.0', |
| 50 | + 'diff' => '3.4.24', |
| 51 | + 'flatpickr' => '4.6.13', |
| 52 | + ]; |
| 53 | + |
47 | 54 | /**
|
48 | 55 | * Perform post-registration booting of services.
|
49 | 56 | */
|
@@ -146,21 +153,25 @@ public function registerMaryJSDirective(): void
|
146 | 153 | Blade::directive('maryJS', function ($expression) {
|
147 | 154 | $parts = Str::of($expression)->explode(',');
|
148 | 155 |
|
149 |
| - $name = Str::of($parts->first())->replace("'", "")->replace('"', ""); |
| 156 | + $file = Str::of($parts->first())->replace("'", "")->replace('"', ""); |
| 157 | + $package = Str::of($file)->before('/')->toString(); |
| 158 | + $version = self::$third_party[$package] ?? 'x'; |
150 | 159 |
|
151 | 160 | $extra = $parts->count() == 2 ? $parts->last() : '';
|
152 | 161 | $extra = Str::of($extra)->replace("'", "")->replace('"', "");
|
153 | 162 |
|
154 |
| - return "<script src='/mary/asset?name=$name' $extra></script>"; |
| 163 | + return "<script src='/mary/asset?name=$file?$version' $extra></script>"; |
155 | 164 | });
|
156 | 165 | }
|
157 | 166 |
|
158 | 167 | public function registerMaryCSSDirective(): void
|
159 | 168 | {
|
160 | 169 | Blade::directive('maryCSS', function ($expression) {
|
161 |
| - $expression = Str::of($expression)->replace("'", "")->replace('"', ""); |
| 170 | + $file = Str::of($expression)->replace("'", "")->replace('"', ""); |
| 171 | + $package = Str::of($file)->before('/')->toString(); |
| 172 | + $version = self::$third_party[$package] ?? 'x'; |
162 | 173 |
|
163 |
| - return "<link rel='stylesheet' type='text/css' href='/mary/asset?name=$expression' />"; |
| 174 | + return "<link rel='stylesheet' type='text/css' href='/mary/asset?name=$file?$version' />"; |
164 | 175 | });
|
165 | 176 | }
|
166 | 177 |
|
|
0 commit comments