Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason you can access <code>stylesheet.css</code> in development is because of how Sprockets works.</p> <p>In development mode ALL requests to anything under /assets are sent to Sprockets to process. Sprockets will directly map requests to paths, one-to-one, so you can access any assets stored in <code>app/assets/etc</code>.</p> <p>All requests go <em>through</em> Sprockets; it is serving the files to your browser.</p> <p>In production things are different. A fingerprint is added to filenames, and the expectation is that you'll precompile your assets to static files. This is for performance reasons - Sprockets is not fast enough to serve lots of requests. </p> <p>Only those CSS and JS files referenced by the default manifests are compiled into application.css and application.js. Other files that you reference are not precompiled unless they are added to the <code>config.assets.precompile</code> array in your config file.</p> <p>You say that the files resolve to <code>/stylesheets/stylesheet.css</code>. The pipeline should generate a path like this in development: <code>/assets/applicaton.css</code>. In production there <em>should</em> be a fingerprint in the filename. What you have posted suggested that the pipeline is not enabled (these are the old, pre 3.1, locations for the files).</p> <p>If this is an upgraded app, it is likely that you have missed some crucial config option. This is the main cause of dev->production issues. Check that the pipeline options are set <em>exactly</em> as they are in the <a href="http://guides.rubyonrails.org/asset_pipeline.html#upgrading-from-old-versions-of-rails" rel="noreferrer">last section</a> of the pipeline guide. (My guess is that you are missing <code>config.assets.enabled = true</code> in application.rb)</p> <p>And for clarity I would suggest changing the name of <code>stylesheet.css</code> to <code>admin.css</code>, while including this in the precompile array (as you already had done).</p> <p>With the config options set correctly, and your admin manifest included in precompile, you should have application.css available for the front end and admin.css available for the back-end, both linkable via the helper methods.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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