I am currently using Rails 4.0.2 with the jQuery user interface (mainly for datepicker). My production environment is Heroku.
My main problem is that the images for my theme are not submitted to production (while it works great in development). I include a css theme like this in mine application.css:
*= require_self
*= require_tree .
*= require jquery-ui-1.10.4.custom
The css theme displays well, but none of the images work. I read endless questions about StackOverflow, blogs and discussions about Github - none of them worked for me. I also read the Edge Rails manual, which doesn't mention the word about image pre-compilation, although from the discussions on Github it seems that this has really changed in Rails 4.
Here is my current directory structure:
/vendor
/assets
/stylesheets
jquery-ui-1.10.4.custom.css
/images
animated-overlay.gif
ui-bg_flat_0_aaaaaa_40x100.png
(more images like these)
As far as I know, the correct way to integrate external css and javascript libraries is to put these assets in / vendor / assets, so this is what I am doing.
So, my problem is that the rails categorically refuse to service any assets in production. I can play around with the url of the image, but it's just not being served.
Here is what I tried:
Force Rails 4 for image precompilation
If I run rake assets:precompile, I see only 2 files inside public / assets - the css file and the javascript file. I guess this is wrong, and that Rails should also post my images.
- 4 - Rails, . ( , , Rails 4, . ASCII?)
, application.rb:
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
, rake assets:precompile, , public/assets/images. , , Rails .
, , , , / ( /, , , ).
config.assets.paths << Rails.root.join('vendor', 'assets', 'stylesheets', 'images')
rake assets:precompile, , .
- JQuery-UI css Rails Asset Pipeline - , Sprockets , , , application.rb.
initializer :after_append_asset_paths,
:group => :all,
:after => :append_assets_path do
config.assets.paths.unshift Rails.root.join("vendor", "assets", "stylesheets", "images").to_s
end
. -: , , . Rails 3, .
//
( Rails), app/assets/images. - . :
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
. , Rails .
,
css, , css , :
background:
, ( , / Github ), , /images URL- . , - , .
,
- Rails 4: Heroku CSS- - production.rb
config.assets.compile = true
, , ( ), .
config.serve_static_assets = false
production.rb, , Rails - , Apache/nginx .
Rails 4?, !