Thanks. Now my assets (css and js) path has changed.
But the path of the media has not changed.
site/plugins/cdn/index.php
<?php
Kirby::plugin('getkirby/cdn', [
'components' => [
'url' => function ($kirby, $path, $options, $original) {
if (preg_match('!assets!', $path)) {
if (option('cdn', false) !== false) {
return option('cdn.domain') . '/' . $path;
} else {
return $original($path, $options);
}
} else {
return $original($path, $options);
}
}
]
]);
site/config/config.php
<?php
return [
'cdn' => [
'domain' => 'http://files.emptyarea.com'
],
'debug' => true,
];