图标未在heroku中显示,但它们在本地

约翰·桑塔纳(Johhan Santana)

application.rb

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Gcp
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
    # Heroku requires this to be false
    config.assets.initialize_on_precompile = false
  end
end

我在推送到heroku之前做了预编译

@font-face {
  font-family: "moon";
  src: url("fonts/icomoon.eot");
  src: url("fonts/icomoon.eot?#iefix") format("embedded-opentype"), url("fonts/icomoon.svg#moon") format("svg"), url("fonts/icomoon.woff") format("woff"), url("fonts/icomoon.ttf") format("truetype");
  font-weight: normal;
  font-style: normal; }

但是,当我启动网站时,它没有任何图标。

https://myapp.herokuapp.com/assets/slide4.jpg
Failed to load resource: the server responded with a status of 404 (Not Found) https://myapp.herokuapp.com/assets/img/timer.png
Failed to load resource: the server responded with a status of 404 (Not Found) https://myapp.herokuapp.com/assets/img/loader.gif
Failed to load resource: the server responded with a status of 404 (Not Found) https://myapp.herokuapp.com/assets/img/large_right.png
Failed to load resource: the server responded with a status of 404 (Not Found) https://myapp.herokuapp.com/assets/img/large_left.png
Failed to load resource: the server responded with a status of 404 (Not Found) https://myapp.herokuapp.com/assets/fonts/icomoon.woff
Failed to load resource: the server responded with a status of 404 (Not Found) https://myapp.herokuapp.com/assets/fonts/icomoon.ttf
GET https://myapp.herokuapp.com/assets/bootstrap.css.map 404 (Not Found) /assets/bootstrap.css.map:1

我还需要做些什么,以便将图标推到heroku后会显示出来。

我修复了CSS无法显示的问题,但现在看来它的路径不正确。

这不是在https://myapp.herokuapp.com/assets/fonts/icomoon.woff他们在https://myapp.herokuapp.com/assets/home/fonts/icomoon.woff等。

在本地,图标可以正常工作。

我的宝石文件

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'better_errors'
gem 'slim'
gem 'heroku'
group :production do
  gem 'rails_12factor'
end

我还需要更改什么:(

萨拉戈萨

一直以来,我都会遇到这个问题,即字体的路径不正确,您必须使用它来确保它,但是它应该类似于

@font-face {
  font-family: "moon";
  src: url("/assets/home/fonts/icomoon.eot");
  src: url("/assets/home/fonts/icomoon.eot?#iefix") format("embedded-opentype"), url("/assets/home/fonts/icomoon.svg#moon") format("svg"), url("/assets/home/fonts/icomoon.woff") format("woff"), url("/assets/home/fonts/icomoon.ttf") format("truetype");
  font-weight: normal;
  font-style: normal; }

看到我在强文本之前添加了“ / assets /”

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Bootstrap图标未在已发布的ASP.NET MVC应用程序中显示

来自分类Dev

菜单中的图标未在android中显示

来自分类Dev

网站图标未在Google Chrome中显示

来自分类Dev

某些Fontawesome图标未在Safari中显示

来自分类Dev

图标未在Rails网站上显示

来自分类Dev

CSS图标在应用程序中本地工作,但未在Heroku上显示吗?

来自分类Dev

在“活动”中的“图像视图”中显示两个以上的图像,但它们之间会有延迟

来自分类Dev

Android通知未在棉花糖中显示颜色图标

来自分类Dev

jquery-ui图标未在生产环境中显示

来自分类Dev

物化CSS图标未在Safari浏览器中显示

来自分类Dev

Android Studio 2.0未在预览中显示菜单图标

来自分类Dev

CSS背景图片未在Heroku中显示

来自分类Dev

svg未在本地显示

来自分类Dev

Heroku环境变量$ DATABASE_URL和$ PORT未在dyno中显示(heroku ps:exec)

来自分类Dev

Rails 6数据未在Heroku本地和应用程序上显示

来自分类Dev

图标未在react-native中显示

来自分类Dev

Excel图标未在扩展坞中显示打开的工作簿

来自分类Dev

网站图标未在Google Chrome浏览器中显示

来自分类Dev

某些Fontawesome图标未在Safari中显示

来自分类Dev

jQuery Mobile图标未在Android 2.3中显示

来自分类Dev

图标未在ActionBar中显示

来自分类Dev

从应用程序中删除了样式表,但它仍显示在Heroku上

来自分类Dev

CSS图标在应用程序中本地工作,但未在Heroku上显示吗?

来自分类Dev

外部SVG图标未在Firefox中显示

来自分类Dev

完整显示目录中的所有文件---但它们之间有一定间隔

来自分类Dev

当前未安装NVIDIA驱动程序,但它们显示在“其他驱动程序”中

来自分类Dev

Laravel 5 中的 CKEditor 4 未在工具栏中显示 iFrame 图标

来自分类Dev

Fontawesome 图标 SVG 未在 Firefox 中显示为 Heremap 标记

来自分类Dev

汉堡图标未在 Vuetify 2.0 中显示

Related 相关文章

  1. 1

    Bootstrap图标未在已发布的ASP.NET MVC应用程序中显示

  2. 2

    菜单中的图标未在android中显示

  3. 3

    网站图标未在Google Chrome中显示

  4. 4

    某些Fontawesome图标未在Safari中显示

  5. 5

    图标未在Rails网站上显示

  6. 6

    CSS图标在应用程序中本地工作,但未在Heroku上显示吗?

  7. 7

    在“活动”中的“图像视图”中显示两个以上的图像,但它们之间会有延迟

  8. 8

    Android通知未在棉花糖中显示颜色图标

  9. 9

    jquery-ui图标未在生产环境中显示

  10. 10

    物化CSS图标未在Safari浏览器中显示

  11. 11

    Android Studio 2.0未在预览中显示菜单图标

  12. 12

    CSS背景图片未在Heroku中显示

  13. 13

    svg未在本地显示

  14. 14

    Heroku环境变量$ DATABASE_URL和$ PORT未在dyno中显示(heroku ps:exec)

  15. 15

    Rails 6数据未在Heroku本地和应用程序上显示

  16. 16

    图标未在react-native中显示

  17. 17

    Excel图标未在扩展坞中显示打开的工作簿

  18. 18

    网站图标未在Google Chrome浏览器中显示

  19. 19

    某些Fontawesome图标未在Safari中显示

  20. 20

    jQuery Mobile图标未在Android 2.3中显示

  21. 21

    图标未在ActionBar中显示

  22. 22

    从应用程序中删除了样式表,但它仍显示在Heroku上

  23. 23

    CSS图标在应用程序中本地工作,但未在Heroku上显示吗?

  24. 24

    外部SVG图标未在Firefox中显示

  25. 25

    完整显示目录中的所有文件---但它们之间有一定间隔

  26. 26

    当前未安装NVIDIA驱动程序,但它们显示在“其他驱动程序”中

  27. 27

    Laravel 5 中的 CKEditor 4 未在工具栏中显示 iFrame 图标

  28. 28

    Fontawesome 图标 SVG 未在 Firefox 中显示为 Heremap 标记

  29. 29

    汉堡图标未在 Vuetify 2.0 中显示

热门标签

归档