-
Hi, I tried to export a simple website but my mix assets are using absolute links with the current domain. How can I avoid this ? For example <link href="{{ asset('css/app.css') }}" rel="stylesheet">
...
<script src="{{ asset('js/app.js') }}"></script> becomes <link href="http://myproject.docker/css/app.css" rel="stylesheet">
...
<script src="http://myproject.docker/js/app.js"></script> |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
My solution for this problem is not excellent but I have chosen to solve it in this way. It would be a change to better identify which console command was executed but I don't know how to do it. i added this script in the class AppServiceProvider which uses a new env only for export. In my specific case, I also forced the use of https
|
Beta Was this translation helpful? Give feedback.
-
This will work temporarily but I think a better approach would be config vars for host and scheme that could be pulled into the package when it's built. |
Beta Was this translation helpful? Give feedback.
-
This is so useful! Thank you! |
Beta Was this translation helpful? Give feedback.
-
Sadly |
Beta Was this translation helpful? Give feedback.
My solution for this problem is not excellent but I have chosen to solve it in this way. It would be a change to better identify which console command was executed but I don't know how to do it.
i added this script in the class AppServiceProvider which uses a new env only for export. In my specific case, I also forced the use of https
public function boot() { if ($this->app->runningInConsole()) { \URL::forceRootUrl(env('APP_URL_EXPORTER')); \URL::forceScheme('https'); } }