amber
amber copied to clipboard
[Assets] Asset helper w/ cached assets
It seems that Amber currently lacks a default convention for caching/versioning bundled assets as well as referencing those cached assets from views (think sprockets in rails). Since Amber already relies on webpack, it would make sense to configure webpack for caching/fingerprinting in production and set up a crystal asset helper that is included in views to easily reference these files (ex. javascript_pack_tag, stylesheet_pack_tag, asset_pack_path, asset_pack_url).
A good reference for doing so would be https://github.com/rails/webpacker, however it obviously doesn't have to be the exact same. It still allows configuration/customization, but comes with a preferred set of defaults out of the box.
@JoshJuncker thanks for the good suggestion.
Would you mind opening a PR with the proposed changes, I think is a good contribution
@eliasjpr what do you think of putting code / functionality like this in external shards?
@eliasjpr Would you guys want the program to fail to compile if you try to reference an asset that doesn't exist?
I think it would probably make sense to build into amber since it depends on configuration in a generated amber project. Also the more shards were dependent on the more brittle our project becomes
#574 will address this issue if someone wants to pickup the mantle and bring this home.
@drujensen I can take a look, although I can't promise much! Do you know what needs doing? Is it mainly the conflicts?
@jackturnbull That would be fantastic. There were several requested changes if I recall. Right now, just getting it working again would be the first step. Maybe fork @JoshJuncker branch?
PR Raised: https://github.com/amberframework/amber/issues/555