- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在浏览所有不提供静态图像的 Rails 4 帖子,但似乎无法缓解我遇到的问题。
看看https://fierce-meadow-1536.herokuapp.com
该 Logo 似乎已提供,因为那是我放置的第一批图像之一。几周后,我开始设计阶段并添加了更多图像,但没有一个出现。
举个例子,灰色标题上写着“所有工作”,下面实际上应该有一个背景图像
你认为发生了什么?
这是我的 Heroku 部署所说的 -->
Fetching repository, done.
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 609 bytes, done.
Total 7 (delta 6), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.5.1
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Using rake (10.1.0)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using tzinfo (0.3.38)
Using builder (3.1.4)
Using rack (1.5.2)
Using erubis (2.7.0)
Using mime-types (1.25.1)
Using activerecord-deprecated_finders (1.0.3)
Using polyglot (0.3.3)
Using arel (4.0.1)
Using bcrypt-ruby (3.0.1)
Using will_paginate (3.0.4)
Using sass (3.2.12)
Using json (1.8.1)
Using execjs (2.0.2)
Using thor (0.18.1)
Using coffee-script-source (1.6.3)
Using fssm (0.2.10)
Using chunky_png (1.2.9)
Using hike (1.2.3)
Using tilt (1.4.1)
Using mini_portile (0.5.2)
Using pg (0.15.1)
Using nested_form (0.3.2)
Using pr_geohash (1.0.0)
Using bundler (1.5.1)
Using rails_serve_static_assets (0.0.1)
Using rubyzip (0.9.9)
Using rails_stdout_logging (0.0.3)
Using ruby-ole (1.2.11.7)
Using temple (0.6.7)
Using rsolr (1.0.9)
Using thread_safe (0.1.3)
Using rack-test (0.6.2)
Using treetop (1.4.15)
Using bootstrap-will_paginate (0.0.9)
Using rdoc (3.12.2)
Using bootstrap-sass (2.3.2.0)
Using uglifier (2.3.2)
Using compass (0.12.2)
Using coffee-script (2.2.0)
Using nokogiri (1.6.0)
Using rails_12factor (0.0.2)
Using slim (2.0.2)
Using spreadsheet (0.9.6)
Using sunspot (2.1.0)
Using mail (2.5.4)
Using compass-rails (1.1.2)
Using sdoc (0.3.20)
Using roo (1.13.0)
Using sprockets (2.10.1)
Using activesupport (4.0.0.rc2)
Using faker (1.1.2)
Using actionpack (4.0.0.rc2)
Using actionmailer (4.0.0.rc2)
Using sprockets-rails (2.0.1)
Using railties (4.0.0.rc2)
Using formtastic (2.2.1)
Using coffee-rails (4.0.0)
Using sass-rails (4.0.0)
Using jquery-rails (3.0.4)
Using chosen-rails (1.0.2)
Using activemodel (4.0.0.rc2)
Using jbuilder (1.5.3)
Using carrierwave (0.9.0)
Using activerecord (4.0.0.rc2)
Using rails (4.0.0.rc2)
Using sunspot_rails (2.1.0)
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Bundle completed (1.34s)
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
cp public/assets/chosen-sprite@2x-5975a8658625306b2570c7c4146f8595.png public/assets/chosen-sprite@2x.png
cp public/assets/chosen-sprite-fa9df9bbee9f1ab89799379cb153636e.png public/assets/chosen-sprite.png
Asset precompilation completed (13.88s)
Cleaning assets
-----> WARNINGS:
You have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:
ruby '2.0.0'
# See https://devcenter.heroku.com/articles/ruby-versions for more information.
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby -> console, rake, web, worker
-----> Compressing... done, 38.9MB
-----> Launching... done, v29
http://fierce-meadow-1536.herokuapp.com deployed to Heroku
这是我的 gemfile -->
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc2'
gem 'bootstrap-sass', '2.3.2.0'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'carrierwave' # for resume upload http://railscasts.com/episodes/253-carrierwave-file-uploads
gem "nested_form" # added to assets pipeline
gem 'roo' # for importing old users http://railscasts.com/episodes/396-importing-csv-and-excel
gem 'sunspot_rails' # one field search -- http://railscasts.com/episodes/278-search-with-sunspot
# for advanced search, try http://railscasts.com/episodes/111-advanced-search-form-revised // very cool way to filter
gem 'annotate', '2.5.0', group: :development
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0.rc2'
gem 'slim'
# 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'
gem 'chosen-rails' #http://harvesthq.github.io/chosen/ https://github.com/tsechingho/chosen-rails
gem 'formtastic'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks' Removed turbolinks, because problems loading camera and common app js http://stackoverflow.com/questions/20662426/rails-not-loading-js-in-chome-from-link-to
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
gem 'rails_serve_static_assets'
end
# Use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
这是我的生产配置文件 -->
Atlas::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { :host => "fierce-meadow-1536.herokuapp.com" }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
end
最佳答案
运行heroku run bash
,然后转到cd public/assets
并运行ls
。您将看到所有图像文件的名称后都附加了一个哈希值(这是为了清除缓存)。
您需要在 scss 文件中使用 scss 助手,而不是使用 url(assets/image-file.png)
使用 image-url('image-file.png) ')
,部署到生产环境时会正确解析镜像名称。
欲了解更多信息,请查看:How to reference images in CSS within Rails 4
关于ruby-on-rails - Heroku Rails 4 静态背景图像未部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21035921/
我正在使用 CSS background: url(stuffhere.jpeg)对于我的背景,但是当你点击其他视频时,“元素”不是页面,背景不会改变。 我试过了 和 ,并尝试为#home 和#pr
这两个 CSS 属性有区别吗: background: none; background: transparent; 它们都有效吗? 应该使用哪一个,为什么? 最佳答案 它们之间没有区别。 如果您没有
csslint 警告回退背景(十六进制或 RGB)应该在 RGBA 背景之前。"evidence="background: rgba(0, 0, 0, 0.8);/* FF3+,Saf3+,Opera
我在我正在制作的新网站上使用 Flip 插件: http://www.concept-it.be/padre (点击联系人,然后点击电子邮件地址)。 正如你所看到的,当翻转开始后,div 的背景变成灰
有没有办法使用“前后”图像作为全尺寸背景?我想会很棒!我正在尝试将此类示例用作整页大小的图像; http://www.catchmyfame.com/2009/06/25/jquery-beforea
我认为答案是否定的,但是... 有没有办法说: background-size: contain 90% 所以它的作用正是 contain 会做的,但是然后将它调整得更小一些? 最佳答案 理想的解决方
将鼠标悬停在给定文本的每个字母上将更改文本的整个字体 + 正文背景颜色。我试过了,但我的尝试失败了。相反,字体只在被悬停的字母之后发生变化,我什至不知道如何从 div 选择器中影响正文背景颜色。 .h
我想给我的 UITableView 提供背景图片,所以我尝试了这个方法: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional
我正在尝试使用 Python 3.6 使用 PIL/Numpy(每个屏幕截图~0.01s)快速截取准备处理的屏幕截图。理想情况下,窗口不需要位于前台,即即使另一个窗口覆盖它,屏幕截图仍然成功。 到目前
我正在尝试做一些可能不可能的事情,但让我们看看你怎么想。这是我的代码: html { background: url(../img/pattern.png) repeat, url(../im
一位设计师想出了这种类型的背景,如下图所示。我想避免使用图像背景。因此,如果可以使用 CSS background 属性复制它,我会努力思考。 最底层只是一个线性渐变,没有问题。但是在其之上分层的圆形
当 TreeView(或应用程序)失去焦点时,如何更改所选 TreeViewItem 的背景。在这种情况下,默认情况下选定的项目具有浅灰色背景。 编辑:第一个答案后的尝试:但是找不到带有 Target
一位设计师想出了这种类型的背景,如下图所示。我想避免使用图像背景。因此,如果可以使用 CSS background 属性复制它,我会努力思考。 最底层只是一个线性渐变,没有问题。但是在其之上分层的圆形
我需要有一个带有 CSS 的背景作为附加的图像我不能让它与线性渐变一起工作。 我正在尝试以下操作,但我无法仅创建 1 个白色条纹。 div { background: #5cbcb0; bac
我有一个ListView,它有一个页眉和页脚。它们在 CardView 中的布局。以及其中必须为背景的内容列表。这是一张可以清楚看到的图片:我现在是这样的: 以及如何做: 我这样做了,ScrollVi
我目前有一个 DIV,其背景图像设置如下: background: url(../images/site/common/body-bannar-bkground.png) repeat 0 0; 如何
我有一个 slider ,需要在不使用 .style.backgroundImage 的情况下更改背景。那么我该如何通过向 slider 或其他东西添加一些类来做到这一点呢? 'use strict'
好的,所以在 photoshop 中,我创建了一个具有透明背景和一些文本的 8 位彩色图像。然后我创建了一个具有透明背景和一些文本的 16 位颜色的图像。 当我右键单击两个图像并转到属性时,它显示两个
我有一个问题困扰着我,我似乎在 Google 上找不到答案。我用一段代码创建了一个小型测试应用程序,它执行如下操作: 在 MainActivity 中,我创建了一个 SomeClass 的实例,它有一
我想做这个, 在 Android Studio 的预览中看起来不错,但在运行时我得到这个 正如您在屏幕开头看到的那样,颜色是白色,我想添加我自己的颜色,在本例中为绿色。 最初它使用的是 Cordina
我是一名优秀的程序员,十分优秀!