-
-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Related: #1724
We currently use laravel-mix for building assets with an opt-in option to use Vite. I think it's time to switch over to using Vite by default, but really what we need is some sort of pluggable system that would allow us to swap these in and out super easy and create new ones if/when something better comes along.
Of course setting up the javascript side will always be a little complex, but we should make the Lucky side super seamless and smooth. Swap a config, maybe run a task, then just setup the front-end how you need it and now you have compile-time safety for your front-end.
Half-baked idea:
Lucky::Server.configure do |settings|
settings.asset_build_system = Lucky::AssetBuilder::Vite.new
end
class Vite < Lucky::AssetBuilder::Base
# somehow define what the manifest structure looks like?
end
The main goal here is that Lucky provides compile-time checks to ensure that things like css, javascript, and images all exist when and where they need to.
# this looks at a manifest.json file that contains "logo.png": "public/assets/images/logo.png"
# and fails to compile if that image doesn't exist in that location
img src: asset("logo.png")On top of just pointing to the location, Lucky also handles cache busters and keeps the mapping correct even if the cache buster is part of the filename or query string.