Sammyjo20 / lasso

🐎 Lasso is a Laravel package created to make your deployments blazing fast.
MIT License
340 stars 16 forks source link

Place assets on CDN during lasso:pull #77

Open haugstrup opened 7 months ago

haugstrup commented 7 months ago

I may be missing something really obvious and if so I apologize. The Lasso workflow is like:

I have a perfectly good CDN sitting around (that's where the zip file is uploaded to). Is there no way to have the JS/CSS bundles be put onto the CDN (unzipped) so my website visitors can download assets from the CDN instead of from y webserver?

Sammyjo20 commented 7 months ago

Hey @haugstrup

No don't worry you're not missing something! That is not currently a feature of Lasso, however it is something I would love for it to be able to do. Maybe it could modify the mix-manifest file to point to the CDN instead when you run lasso:pull?

haugstrup commented 7 months ago

I will fully admit that my knowledge of Max is pretty limited. I did find old documentation that setting a MIX_ASSET_URL env option should change the URL Mix generates: https://laravel.com/docs/8.x/mix#custom-mix-base-urls

I can't find reference to it in the current documentation so I don't know if it still exists (I'd think so though).

lasso:publish could publish unzipped assets along with the zipped ones and then people could set MIX_ASSET_URL to point to the CDN?

Sammyjo20 commented 7 months ago

It's been a while for me too, but that could work. The assets could be uploaded somewhere specified on the CDN (or just use a disk that points to the CDN) and then the user could define the CDN URL though mix. I'll have a think about it, thanks!