gpt4 book ai didi

javascript - CSS 在 rake Assets :clobber 后不呈现

转载 作者:行者123 更新时间:2023-11-28 09:57:07 25 4
gpt4 key购买 nike

在推送到 heroku 时,我在预编译 Assets 时遇到了问题。特别是我目前代码中的一点点 javascript。根据我读到的一些东西,我尝试了 rake assets:clobber 然后再次预编译。这样做之后,我的 CSS 仍然存在于我的代码中,但页面在生产和开发中只呈现 HTML。我还尝试删除浏览器缓存以及让其他人从另一个确认了相同问题的站点访问该应用程序。老实说,我不确定到底要在这里显示什么,因为我真的不知道问题出在哪里,所以如果您需要查看其他任何内容,请告诉我。似乎一切都完好无损。我还没有找到这个问题的满意答案,希望能提供一些意见。谢谢。

一些来自生产的源代码有错误

head:after {
font-family: sans-serif;
font-size: large;
font-weight: bold;
content: "Error compiling CSS asset";
}

body:before, body:after {
font-family: monospace;
white-space: pre-wrap;
}

body:before {
font-weight: bold;
content: "\000a Sass::SyntaxError: Invalid CSS after \0022 \002f *\0022 : expected \0022 \002f \0022 , was \0022 * This is a man...\0022 \000a (in \002f app\002f app\002f assets\002f stylesheets\002f application.css)";
}

body:after {
content: "\000a (sass):1";
}

自定义.css.scss

@import " Bootstrap ";

/

* mixins, variables, etc. */

$grayMediumLight: #eaeaea;

@mixin box_sizing {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

/* universal */
html {
overflow-y: scroll;
}

.container {
max-width: 1170px;
margin-right: auto;
margin-left: auto;
box-sizing: border-box;
}

div {
display: block;
}

section {
overflow: auto;
}

textarea {
resize: vertical;
}

.center {
text-align: center;
}

.center h1 {
margin-bottom: 10px;
}

/* typography */



h1, h2, h3, h4, h5, h6 {
line-height: 1;
}

h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}

h2 {
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: 500;
font-size: 93px;
color: white;
font-family: Helvetica;
}



.hero-unit {
padding: 60px;
margin-bottom: 30px;
font-size: 18px;
font-weight: 200;
line-height: 30px;
color: inherit;
background-color: #eeeeee;
}

p {
font-size: 1.1em;
line-height: 1.7em;
}


/* Header */



.btn-lg {
color: white;
background-color: transparent;
margin-top: 20px;

}

.col-lg-6 {
width: 50%;
margin-top: 60px;
color: white;
}

#home-header {
background-image: url("firepit_80opac.png");
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 841px;
display: block;
}

.header-description h2 {
font-weight: 100;
font-family: inherit;
font-size: 93px;
color: rgb(255, 255, 255);
text-shadow: 0 0px 12px rgba(36, 36, 36, 0.55);
padding: 0px 0 4px 0;
}

#logo {
float: left;
margin-top: 20px;
font-size: 1.7em;
color: #fff;
text-transform: uppercase;
letter-spacing: -1px;
font-weight: bold;
line-height: 1;
&:hover {
color: white;
text-decoration: none;
}
}




.navbar-inner ul li {
display: inline-block;
padding: 10px 15px 10px;
}

.header-btn {
color: white;
margin: 0px auto;
text-transform: uppercase;
width: 20%;
font-weight: 300;
font-size: 24px;
padding: 20px 35px;
border: 2px solid rgb(219, 82, 47);
background: rgb(219, 82, 47);
display: block;
-webkit-border-radius: 9px;
border-radius: 9px;
text-align: center;
}



.header-btn:hover {
background-color: transparent;
color: white;
text-decoration: none;
}



.header-description {
margin: 100px 0 80px;
}

.row {
margin-right: -15px;
margin-left: -15px;
}

/* site header */


.nav li a {
color: #db522f;
}

/* home-footer */


.row.home-footer {
margin-right: auto;
margin-left: auto;
display: block;
height: 200px;
background: rgb(243, 243, 243);
position: relative;
}


.col-md-4 {
width: 33.3%;
margin-right: -15px;
margin-left: 15px;
}

.col-md-4 {
color: rgb(124, 124, 124);
}

/* carousel */
#quote-carousel
{
padding: 0 10px 30px 10px;
margin-top: 30px;
}

/* Control buttons */
#quote-carousel .carousel-control
{
background: none;
color: #222;
font-size: 2.3em;
text-shadow: none;
margin-top: 30px;
}
/* Previous button */
#quote-carousel .carousel-control.left
{
left: -12px;
}
/* Next button */
#quote-carousel .carousel-control.right
{
right: -12px !important;
}
/* Changes the position of the indicators */
#quote-carousel .carousel-indicators
{
right: 50%;
top: auto;
bottom: 0px;
margin-right: -19px;
}
/* Changes the color of the indicators */
#quote-carousel .carousel-indicators li
{
background: #c0c0c0;
}
#quote-carousel .carousel-indicators .active
{
background: #333333;
}
#quote-carousel img
{
width: 250px;
height: 100px
}
/* End carousel */

.item blockquote {
border-left: none;
margin: 0;
}

.item blockquote img {
margin-bottom: 10px;
}

.item blockquote p:before {
content: "\f10d";
font-family: 'Fontawesome';
float: left;
margin-right: 10px;
}



/**
MEDIA QUERIES
*/

/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
#quote-carousel
{
margin-bottom: 0;
padding: 0 40px 30px 40px;
}

}

/* Small devices (tablets, up to 768px) */
@media (max-width: 768px) {

/* Make the indicators larger for easier clicking with fingers/thumb on mobile */

#quote-carousel .carousel-indicators {
bottom: -20px !important;
}
#quote-carousel .carousel-indicators li {
display: inline-block;
margin: 0px 5px;
width: 15px;
height: 15px;
}
#quote-carousel .carousel-indicators li.active {
margin: 0px 5px;
width: 20px;
height: 20px;
}
}

生产.rb

Rails.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 threaded 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 = true

# Generate digests for assets URLs.
config.assets.digest = true

# `config.assets.precompile` has moved to config/initializers/assets.rb

# 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

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true

# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify

config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: Rails.application.secrets.domain_name,
authentication: "plain",
enable_starttls_auto: true,
user_name: Rails.application.secrets.email_provider_username,
password: Rails.application.secrets.email_provider_password
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => Rails.application.secrets.domain_name }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false


# 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

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end

开发.rb

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = false

config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: Rails.application.secrets.domain_name,
authentication: "plain",
enable_starttls_auto: true,
user_name: Rails.application.secrets.email_provider_username,
password: Rails.application.secrets.email_provider_password
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
# Send email in development mode?
config.action_mailer.perform_deliveries = true


# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

最佳答案

这里是愚蠢的错误。我不小心删除了 application.css 文件中的一个字符。用 * 而不是 */。

关于javascript - CSS 在 rake Assets :clobber 后不呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24873314/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com