In a Rails 4 application, how do I compile jQuery Mobile button icons?

I am developing a rails 4 application with jQuery Mobile and using jquery_mobile_rails gem, which means that I do not need to install any jQuery files. My problem is that there are no icons for the buttons. They are displayed in development, but not in production. I guess I just need to compile them, but where are they and how can I do this?

Since I do not use jQuery Mobile files directly, I have no way to store icons under them. The gem works in development mode, but not in production mode. Can I assume that gems contain button icons inside? If so, I find it difficult to understand why they do not work in production mode.

jquery-rails (2.3.0) jquery_mobile_rails (1.3.0) 
+6
source share
1 answer

There is currently a known issue with Rails 4 when precompiling assets in an environment.

Try to install:

 config.assets.precompile=true 

in config/application.rb .

If this still does not work, try adding the following to config/application.rb :

 config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) 

I can not reproduce the strange error that occurs when combining these files in config.assets.precompile . Can you try the answer to this question (replace the line above):

 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 } 
+2
source

Source: https://habr.com/ru/post/946656/


All Articles