Ror App: "The Asset 'Application.CSS' Is Not Present in The Asset Pipeline" After Moving to Production Server

Rails: application.css not in asset pipeline

origin answer

in my case, I forgot to install yarn command in my server.

so, please install yarn before running rails server. otherwise assets:precompile will do nothing and give no warning.

update

also, make sure all of these things:

  1. file exists: app/assets/stylesheets/application.css
  2. its content looks like:
/* ...
*= require_self
*= require_tree .
*/

  1. also check file app/assets/config/manifest.js,
//= link application.css

RoR App: The asset 'application.css' is not present in the asset pipeline after moving to production server

You can confirm your app/assets/stylesheets folder it should have application.css file and you will have to precompile assets in production environment before go/start server in production environment.
You can precompile assets using

RAILS_ENV=production rails assets:precompile

If it still does not work then you can try the config.assets.compile option to true in production.rb so it will do live compilation. Although it should be false in production environment as it impact on performance.

config.assets.compile = true

ActionView::Template::Error (The asset *.css is not present in the asset pipeline.):

In case anyone comes across this and no other posts are helping..

Here are the steps after cloning and app, and adding new git remote to use for heroku...

  1. add stylesheets to assets.rb
  2. precompile locally
  3. push to heroku

I kept pushing to heroku just after adding it to the assets.rb which i could not understand why that wouldn't work.

Heroku rake assets:precompile don't run build:css - application.css is not present in the asset pipeline

SOLVED

Renamed

From

app/assets/stylesheets/application.saas.scss

to

app/assets/stylesheets/application.scss

and updated package.json

"build:css": "sass ./app/assets/stylesheets/application.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules"

Rails - Asset is not present in asset pipeline when using image_tag

The asset "aussen" is not present in the asset pipeline.

Technically true because you have not aussen but you have aussen.jpg so it will be <%= image_tag("aussen.jpg") %>

Look, while you use <%= image_tag("aussen") %> then it will be genarate HTML like this

<%= image_tag("aussen") %>
#=> <img alt="Aussen" src="/assets/aussen" />

While you use <%= image_tag("aussen.jpg") %> then it will be genarate HTML like this

<%= image_tag("aussen.jpg") %>
#=> <img alt="Aussen" src="/assets/aussen.jpg" />

When it's going into production mode then it will be shown some encrypted key on the page source like this

aussen-d2fb0029a12281121a1752c599e715a8e2b3db17f1e8e18248a79a7b1ca63b91.jpg

image_tag AssetTagHelper see this for reference.

Update production.rb file config.assets.compile false to true

# config/environments/production.rb
...
config.assets.compile = true
...


Related Topics



Leave a reply



Submit