Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3.1 assets pipeline in production
    primarykey
    data
    text
    <p>I am using the assets pipeline (in Rails 3.1.3) and am kind of struggling to make it work in production.</p> <h2>Situation</h2> <p>In my <code>/app/assets/stylesheets</code> directory I have the following files:</p> <pre><code>application.css --&gt; this is the default rails one stylesheet.css --&gt; This is my custom stylesheet </code></pre> <p>I spent a lot of time getting my <code>stylesheet.css</code> included in the <code>/public/assets/</code>directory in production (by running <code>rake assets:precompile</code>) and I finally made it by adding the following line into in my <code>application.rb</code> file:</p> <pre><code> config.assets.precompile += ['stylesheet.css'] </code></pre> <p>I know have the right precompiled <code>stylesheet.css</code> file in production.</p> <h2>My Problem</h2> <p>The problem I have is when using <code>stylesheet_link_tag</code> with my <code>stylesheet.css</code> file. It turns out:</p> <p><code>&lt;%= stylesheet_link_tag "stylesheet" %&gt;</code> is resolved into <code>&lt;link href="/stylesheets/stylesheet.css" media="screen" rel="stylesheet" type="text/css"&gt;</code> <strong>in production</strong> I would expect the path to be resolved into <code>/assets/stylesheet.css</code> <strong>just like it does in development</strong>.</p> <p>What is even more surprising is that <code>application.css</code> behaves perfectly even though <code>&lt;%= stylesheet_link_tag "application"%&gt;</code> resolves into <code>&lt;link href="/stylesheets/stylesheet.css" media="screen" rel="stylesheet" type="text/css"&gt;</code>. What I don't understand is that the public/stylesheets/ directory does not exist in rails 3.1.</p> <p>Any idea ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload