最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Rails 8 Asset Pipeline: How do I determine if an asset exists with Propshaft? - Stack Overflow

programmeradmin2浏览0评论

Before Propshaft you would use Rails.application.assets.find_asset(path).present?.

But how do you check if an asset exists using the new asset library for Rails 8?

Before Propshaft you would use Rails.application.assets.find_asset(path).present?.

But how do you check if an asset exists using the new asset library for Rails 8?

Share Improve this question edited Mar 16 at 18:07 Timothy Alexis Vass asked Mar 15 at 18:07 Timothy Alexis VassTimothy Alexis Vass 2,7252 gold badges13 silver badges32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

With Propshaft, this is handled by the resolver.

Rails.application.assets.resolver.resolve(logical_path).present?

发布评论

评论列表(0)

  1. 暂无评论