Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 rails 应用程序中,我使用两个接口(foruser和admin)。资产目录也分开(assets和admin/assets)今天我需要为两个接口实现相同的资产。
user
admin
assets
admin/assets
我怎样才能做到这一点并避免文件重复?
我建议将应用程序资产的通用放在默认文件夹app/assets中,并将特定于管理员的资产放在app/admin/assets. 这样,您将拥有默认资产,这些资产将被管理资产覆盖。例如:如果您放置background-color: blue在您的app/assets/stylesheets/mystyles.scss中,它将被管理员命名空间中的 inbackground-color: red覆盖。app/assets/stylesheets/myadminstyles.scss
app/assets
app/admin/assets
background-color: blue
app/assets/stylesheets/mystyles.scss
background-color: red
app/assets/stylesheets/myadminstyles.scss