2017-09-03 1 views
2

In Rails 5.1.3 Ich ändere Logo-Datei in App/Assets/Bilder Dann Fehler nicht wissen, was zu beheben ist. Weiß jemand ?Das Asset "logo.png" ist nicht in der Asset-Pipeline vorhanden

The asset "logo.png" is not present in the asset pipeline. 

Bereits Neustart Schienen versuchen, Schienen sauber, Schienen oder Schienen Vermögen: precompile

Hier ist meine config/initializers/assets.rb

# Be sure to restart your server when you modify this file. 

# Version of your assets, change this if you want to expire all your assets. 
Rails.application.config.assets.version = '1.0' 

# Add additional assets to the asset load path. 
# Rails.application.config.assets.paths << Emoji.images_path 
# Add Yarn node_modules folder to the asset load path. 
Rails.application.config.assets.paths << Rails.root.join('node_modules') 

# Precompile additional assets. 
# application.js, application.css, and all non-JS/CSS in the app/assets 
# folder are already added. 
# Rails.application.config.assets.precompile += %w(admin.js admin.css) 

Antwort

1

wie die

Erste Versuche gehe zu

app/assets/images 
erstellen 0

zweiten Ordner Logos

app/assets/images/logos 

Third put Bild Logos

app/assets/images/logos/logo.png 

und Last gesetzt in Ihre Anwendung setzen diesen Code

<%= link_to image_tag("logos/logo.png"), root_path %> 

Es wird Arbeit überall

+0

immer noch angezeigt, ist nicht in der Asset-Pipeline vorhanden. –

4

Ich hatte ein ähnliches Problem. Die Lösung bestand darin, die Dateierweiterung auf dem Bild hinzuzufügen.

= image_tag 'logo', alt: '' 

zu

= image_tag 'logo.jpg', alt: '' 
-1

Hier ist, was ich tat mein Problem nichts falsch mit meinem Code angenommen zu lösen und es funktioniert:

  1. Reinvermögen Cache in/tmp/Vermögen mit diesem Befehl:
$rake tmp:clear 

wie gesagt here

  1. Precompile Vermögenswerte wieder mit diesem Befehl:
$rake assets:precompile 
-1

Dies ist, wie ich dieses Problem behoben.

I wurde unter Verwendung von Doppel qoutes

"<% = image_tag (" 'core-img/Daumens.png ' "alt: "")%>"

Sollten nur einzelne Anführungszeichen gesetzt werden um den Dateinamen

"<% = image_tag ('core-img/thumb.png', alt : "")%>“

Stop-Server,

Rake Vermögen $: precompile

und dann

$ Schienen s

Und es funktioniert!

Verwandte Themen