I'd say this should be very straigh forward for a basic use case: just use the asset server's URL in all links in the HTML that reference a static file. The only issue I see is that you can't use relative paths for the src
and href
attributes in the HTML, but need to instead always type the fully qualified path to the other domain.
I've adapted Dayle Rees' approach to this, since it allows me to serve assets locally in development and refer to my CDN provider of choice in production.
The project can be found at: https://github.com/daylerees/website
Reference these files for usage:
Autoload: https://github.com/daylerees/website/blob/master/composer.json (See lines 12-14)
Config: https://github.com/daylerees/website/blob/master/app/config/website.php (See lines 30-38)
Helper: https://github.com/daylerees/website/blob/master/src/Website/Helper/cdn.php
Usage: https://github.com/daylerees/website/blob/master/src/Website/views/base.blade.php (See lines 13,17 and more)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community