1

rails 4.0.1 Hi! I have a blog application and I did place in application.css some css file and it didn't reflect my output. And Jquery-rails is also installed in my bundle but I don't have jquery in my output

name_of_app/articles/1

<link href="/stylesheets/all.css" media="screen" rel="stylesheet" />
  <script src="/javascripts/defaults.js"></script>

/stylesheets/all.css and /javascripts/defaults.js output the same file.

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8" />
      <title>Action Controller: Exception caught</title>
      <style>
        body {
          background-color: #FAFAFA;
          color: #333;
          margin: 0px;
        }

        body, p, ol, ul, td {
          font-family: helvetica, verdana, arial, sans-serif;
          font-size:   13px;
          line-height: 18px;
        }
...
2
  • Do you have asset pipeline enabled? Commented Dec 24, 2013 at 20:39
  • thks J.Wood. No I don't have it enable : So now i place 'config.assets.enabled = true' in comfig/application.rb in the class Application. but I have the same result Commented Dec 24, 2013 at 20:42

1 Answer 1

1

I guess type='text/css' is missing in <link href="/stylesheets/all.css" media="screen" rel="stylesheet" />

Per rails convention try to use manifest-files-and-directives

With this you can create

#app/assets/stylesheets/application.css

/*
 *= require_self
...
*/

#layout/application.html.erb
<%= stylesheet_link_tag 'application' %>
Sign up to request clarification or add additional context in comments.

3 Comments

Thks Swapnilabnave it's works. I had code <%= stylesheet_link_tag :all %> I tought :all was supposed to merge all my .css file
But the type='text/css' is still missing in my output <link href="/assets/application.css?body=1" media="screen" rel="stylesheet" /> is it matters?
Rails 4.0.2 stylesheet_link_tag says no MIME type attribute whereas Rails 3.2.13 stylesheet_link_tag has type attribute. I guess the .css extension might be making the difference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.