mar*_*cks 6 ruby-on-rails jquery-mobile
我正在使用jQuery Mobile开发rails 4应用程序并使用jquery_mobile_rails gem,这意味着我不需要安装任何jQuery文件.我的问题是按钮没有图标.这些显示在开发中但不在生产中.我假设我只需要编译它们但它们在哪里以及我该怎么做?
由于我没有直接使用jQuery Mobile文件,因此我无法选择将它们存储在它们下面.gem在开发模式下工作,但在生产模式下不工作.我可以假设宝石内部包含按钮图标吗?如果是这样,我无法理解他们为什么不在生产模式下工作.
jquery-rails (2.3.0)
jquery_mobile_rails (1.3.0)
Run Code Online (Sandbox Code Playgroud)
目前,Rails 4在按环境预编译资产时存在一个已知问题。
尝试设置:
config.assets.precompile=true
Run Code Online (Sandbox Code Playgroud)
在config/application.rb。
如果仍然不起作用,请尝试将以下内容添加到config/application.rb:
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
Run Code Online (Sandbox Code Playgroud)
我无法复制将这些文件连接到config.assets.precompile. 您可以尝试回答这个问题吗(替换上面的行):
config.assets.precompile << Proc.new { |path|
if path =~ /\.(css|js|png|jpg|jpeg|gif)\z/
full_path = Rails.application.assets.resolve(path).to_path
app_assets_path = Rails.root.join('app', 'assets').to_path
vendor_assets_path = Rails.root.join('vendor', 'assets').to_path
if ((full_path.starts_with? app_assets_path) || (full_path.starts_with? vendor_assets_path)) && (!path.starts_with? '_')
puts "\t" + full_path.slice(Rails.root.to_path.size..-1)
true
else
false
end
else
false
end
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
651 次 |
| 最近记录: |