Is there an official way versioning stylesheets and scripts? Like with asset_style() add version key or something
For now I did the old Elixir way. I just compile css/js and output them to public.
and in the metadata I echo them like elixir('js/app.js');
I think you know how it works!
Nothing built in right now no but that's not a bad idea. How would this work do you think?
This versioning is for browser cache busting.
I do not know, how exactly the asset building is working in PyroCMS, but each time the new asset is built/compiled, either it did not exist, asset cache was purged or assets were updated (this is what causes problems), a new version key is generated and injected into the html tag by asset_style or asset_script
This version key could be some cheap hash like crc32 or similar. No need to have an incremental integer.
I like that. So randomize it during dev and for production it would remain the same unless maybe a bump command or something?
mhhh, this might actually be better what i was proposing. Like for dev new key is generated for each load but for production you must issue artisan command to pump the version.
+1 for this. Maybe you can get some inspiration from this package: https://github.com/spekkionu/laravel-assetcachebuster
@ryanthompson any news about this?