Note that there are some explanatory texts on larger screens.

plurals
  1. PORails Asset Not Generating Correct URL for Precompiled Asset
    primarykey
    data
    text
    <p>I am developing a site with Ruby on Rails 4 and am having issues with paths to some CSS files.</p> <p>I have the following assets which are not included in my <code>applicaiton.sass</code> file:</p> <ul> <li>mobile.scss</li> <li>mozilla.scss</li> <li>msie.scss</li> <li>opera.scss</li> <li>webkit.scss</li> </ul> <p>I have included them in my <code>application.rb</code> to be precompiled using the following:</p> <pre><code>config.assets.precompile += [ 'mobile.css', 'mozilla.css', 'msie.css', 'opera.css', 'webkit.css' ] </code></pre> <p>On my production server I have run the following commands (Note: the <code>touch</code> command is to make sure the app restarts and clears the cache since I am using Phusion Passenger with Nginx as my server):</p> <pre><code>rake assets:precompile RAILS_ENV=production touch tmp/restart.txt </code></pre> <p>After running the above commands I noticed the assets were precompiled and reside in my <code>public/assets/</code> directory. They are also correctly listed in the <code>manifest.json</code> file in the <code>public/assets/</code> directory.</p> <p>When I load the site in my browser and look at the source code I notice the browser specific CSS file is not using the correct asset path. It shows:</p> <pre><code>&lt;link href="/assets/application-ec1031f251a585c79d4404ef2899f6d1.css" media="screen" rel="stylesheet" /&gt; &lt;link href="/stylesheets/webkit.css" media="screen" rel="stylesheet" /&gt; </code></pre> <p>While I expect to see:</p> <pre><code>&lt;link href="/assets/application-ec1031f251a585c79d4404ef2899f6d1.css" media="screen" rel="stylesheet" /&gt; &lt;link href="/assets/webkit-70899fec75bb8eae24edae491a94f73a.css" media="screen" rel="stylesheet" /&gt; </code></pre> <p>My view looks uses the following code:</p> <pre><code>&lt;% if @mobile %&gt; &lt;%= stylesheet_link_tag :mobile %&gt; &lt;% else %&gt; &lt;%= stylesheet_link_tag :application %&gt; &lt;%= stylesheet_link_tag :msie if @browser == 'Internet Explorer' %&gt; &lt;%= stylesheet_link_tag :opera if @browser == 'Opera' %&gt; &lt;%= stylesheet_link_tag :mozilla if @browser == 'Mozilla' %&gt; &lt;%= stylesheet_link_tag :webkit if @browser == 'Webkit' %&gt; &lt;% end %&gt; </code></pre> <p>My question is shouldn't the <code>webkit.css</code> path be outputting correctly or is there something I am missing? Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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