Assets are not compiling

152 views
Skip to first unread message

Loganathan Sellapa

unread,
Sep 6, 2012, 12:06:37 PM9/6/12
to Rails
Hi All,

I have the css assets as in the below order .

Assets structure:
assets/stylesheets
               --->application.css.erb
               ---->ie/application_ie.css.erb

In my layout file:


 <%= stylesheet_link_tag "application" %>
 <!--[if IE]> <%= stylesheet_link_tag "ie/application_ie" %> <![endif]-->


With this configuration I pre compiled the assets with the command "RAILS_ENV=production bundle exec rake assets:precompile", then started the server in production mode, at this time below exception was raised.

ActionView::Template::Error (ie/application_ie.css isn't precompiled):
    6:  
    7:   <%= javascript_include_tag "application" %>
    8:   <%= stylesheet_link_tag "application" %>
    9:   <!--[if IE]> <%= stylesheet_link_tag "ie/application_ie" %> <![endif]-->
    10:  
    11:   <script>
    12:     $(function() { $('a.popup').colorbox(); });
  app/views/layouts/application.html.erb:9:in `_app_views_layouts_application_html_erb___593026760_72691670'


So I have updated the production.rb file  with "config.assets.precompile += %w(ie/application_ie.css)", then I didnt face any exception but application styles were completely gone. Please let me know how to fix this,FYI pasted below the server log.

Started GET "/assets/logo-3c359bbe395ac088f76e1fd0e81782d1.png" for 127.0.0.1 at 2012-09-06 21:20:43 +0530
ActionController::RoutingError (No route matches [GET] "/assets/logo-3c359bbe395ac088f76e1fd0e81782d1.png"):
  actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.6) lib/rails/engine.rb:479:in `call'
  railties (3.2.6) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /home/loganathan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /home/loganathan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /home/loganathan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'




Started GET "/favicon.ico" for 127.0.0.1 at 2012-09-06 21:20:50 +0530

ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
  actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.6) lib/rails/engine.rb:479:in `call'
  railties (3.2.6) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /home/loganathan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /home/loganathan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /home/loganathan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

regards,
Loganathan
ViewMe


sjm

unread,
Sep 7, 2012, 5:01:12 AM9/7/12
to rubyonra...@googlegroups.com
Hi,

I had this problem too, but resolved it by creating another application.css manifest file specifically for IE, I placed it in the same directory as the CSS file for IE.

You'd obviously need to compile the assets again.

The conditional inclusion should then work for IE.

There may be other (better?) ways of doing it, but this worked for me.

I hope that this helps.

All the best,

Steve

Loganathan Sellapa

unread,
Sep 7, 2012, 5:03:24 AM9/7/12
to rubyonra...@googlegroups.com
Thanks Steve I will do it and let you know.

regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/PP9ZUHXzvgEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Loganathan Sellapa

unread,
Sep 10, 2012, 6:44:33 AM9/10/12
to rubyonra...@googlegroups.com
Fixed it by pasting the below code in production.rb.
  config.serve_static_assets = true

regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe




Reply all
Reply to author
Forward
0 new messages