Papouche Guinslyzinho
Papouche Guinslyzinho

Reputation: 5468

Rails Javascript and Css doesn't load

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;
        }
...

Upvotes: 1

Views: 697

Answers (1)

swapab
swapab

Reputation: 2420

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' %>

Upvotes: 1

Related Questions