Not to burst your bubble on your acheivement, but isn't this already handled in Laravel with Vite?
New way to load CSS & JS assets - Basset. What do you think?
Hey everyone! My colleague Antonio and I have spent the past few months building this package that we think is very cool - would love to see what you think about it. It's helped Backpack's package size go from 90MB down to 2MB (๐ฑ) and I think it could help other projects and packages with similar improvements.

Basically.. it's a super-easy way to use CSS and JS assets. You get to use them the same way, not matter if they're from CDNs, from non-public directories etc. You do @basset('https://example.com/path/to/file.css') and it will take that asset from wherever it is, cache it in a public directory in your Laravel app, and serve it, finally outputting <link href="/bassets/path/to/file">
It's especially useful for those who don't like bundling, NPM etc. Soo... people like me ๐
That way:
- you no longer worry about GDPR with CDNs;
- you don't have to manually publish assets from packages (you can load them indirectly from the vendor dir);
- you don't have to move stuff from non-public directories to public directories;
- you can even point to assets that are outside the current Laravel app (but... yeah... maybe you shouldn't ๐ );
What do you think - good idea or bad, for your projects? Any projects you would use this on? What should we do to better explain what this does and its benefits?
More info here: https://github.com/laravel-backpack/bassets
Thanks for the feedback!
(long time Laracasts user, just created a new account to not use the company one)
Please or to participate in this conversation.