我正在尝试构建一个“管理后端”Rails 引擎。假设引擎有以下资产:
ENGINE/app/assets
├── javascripts
│ └── railsyard
│ ├── admin.js.coffee
│ ├── admin_customizations.js.coffee
...
需要的地方,admin.js.coffee
即admin_customizations.js.coffee
准备被托管 Rails 应用程序覆盖的空文件。
[ENGINE/app/assets/javascripts/my_engine/admin.js.coffee]
#= require admin_customizations
# ...some code...
[ENGINE/app/assets/javascripts/my_engine/admin_customizations.js.coffee]
# Override this empty file to add custom JS behaviour!
一切都很好,直到我尝试要求一些来自次要宝石的资产:
[APP/app/assets/javascripts/my_engine/admin_customizations.js.coffee]
#= require modernizr # this line gets ignored
alert "Foobar" # this line works
gemmodernizr-rails
是托管应用程序而不是引擎的依赖项。请注意,如果我尝试modernizr
从不是某些引擎资产文件的覆盖的资产文件中请求,一切都会再次起作用。
有没有办法解决这种情况?