Amber: [Assets] Asset helper w/ cached assets

Created on 20 Jan 2018  路  8Comments  路  Source: amberframework/amber

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.

optimization help-wanted

Most helpful comment

@eliasjpr Would you guys want the program to fail to compile if you try to reference an asset that doesn't exist?

All 8 comments

@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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aarongodin picture aarongodin  路  7Comments

faustinoaq picture faustinoaq  路  5Comments

ZeroPointEnergy picture ZeroPointEnergy  路  4Comments

elorest picture elorest  路  7Comments

drujensen picture drujensen  路  6Comments