Note that there are some explanatory texts on larger screens.

plurals
  1. PORails AssetNotPrecompiledError even though the assets are being precompiled
    primarykey
    data
    text
    <p>I'm new to both Ruby and Rails, I've been mulling over this for days and haven't found a solution. My project works fine on my development environment, but it won't on my alpha or production environments.</p> <p>I have the following stylesheets on my app/assets/stylesheets folder:</p> <pre><code>app --&gt; assets --&gt; stylesheets --&gt; modules --&gt; _header.css.scss --&gt; _footer.css.scss --&gt; home.css.scss --&gt; user.css.scss --&gt; help.css.scss </code></pre> <p>When I try using my alpha environment (that is, by running <code>rails s --environment=alpha</code>) I get this error:</p> <pre><code>Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Home#index Showing /app/views/home/index.haml where line #1 raised: home.css isn't precompiled </code></pre> <p>I'm adding that stylesheet to my view by using <code>stylesheet_link_tag('home')</code>.</p> <p>My <code>alpha.rb</code> file has this:</p> <pre><code>config.assets.compile = false config.assets.precompile += %w( help.css home.css users.css ) config.assets.compress = true config.assets.debug = false </code></pre> <p>I am running the precompile task (that is, <code>rake assets:precompile RAILS_ENV=alpha</code>). The task seems to be working properly. This is the output:</p> <pre><code>rake assets:precompile RAILS_ENV=alpha --trace ** Invoke assets:precompile (first_time) ** Execute assets:precompile /ruby-1.9.3-p286/bin/rake assets:precompile:all RAILS_ENV=alpha RAILS_GROUPS=assets --trace ** Invoke assets:precompile:all (first_time) ** Execute assets:precompile:all ** Invoke assets:precompile:primary (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Invoke rails_admin:disable_initializer (first_time) ** Execute rails_admin:disable_initializer [RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it. ** Execute environment ** Invoke tmp:cache:clear (first_time) ** Execute tmp:cache:clear ** Execute assets:precompile:primary </code></pre> <p>My files do end up in <code>/public/assets/</code>, and the <code>/public/assets/manifest.yml</code> is being created and has my files listed in it:</p> <pre><code>application.css: application.css help.css: help.css home.css: home.css users.css: users.css </code></pre> <p>If I try to access the server (by going to <code>http://localhost:3000</code>) I get the previously mentioned <code>AssetNotPrecompiledError</code> error for <code>home.css</code>; however, <code>http://localhost:3000/assets/home.css</code> does return the stylesheet.</p> <p>AFAIK this error is being generated because Rails doesn't know where <code>home.css</code> is located; however, it is listed on the <code>manifest.yml</code>, where I think it's supposed to look for it.</p> <p>If you need any more information I'll be happy to provide it. This is driving me nuts!</p> <p>-- EDIT --</p> <p>As per Qumara SixOneTour's request, here is my application.css.scss:</p> <pre><code>@import 'modules/header'; @import 'modules/footer'; body { background: $bgColor asset-url('bgFull.jpg', image) repeat-x center top; } div.main { padding: 35px 30px; background: $whitweColor; margin-top: -3px; padding-bottom: 30px; @include border-bottom-left-radius(5px); @include border-bottom-right-radius(5px); h1 { font-size: 2em; } h2 { font-size: 1.5em; } } @media only screen and (max-width: 767px) { body { background: $bgColor asset-url('bg.png', image) repeat-x; } } </code></pre> <p>Basically, I don't use a manifest, but instead load separate css files in every view.</p>
    singulars
    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.
    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