سؤال

لقد كنت أحاول تشغيل الخادم الخاص بي خلال الساعات القليلة الماضية.أنا باستخدام إنجن إكس والقضبان الركاب.

في مجلد الأصول العامة/الأصول الخاص بي ، لدي جميع الأصول المجمعة مسبقا ، ولديها نوع من السلسلة الملحقة بها مثل الشعار-3464 دي بي 64640 أد 071 أف أيه 1 أف 29714 سي بي 888.ينغ أن إم التخمين هو نوع من معرف فريد.

عندما أذهب إلى تطبيقي في متصفحي ، لا يتم تحميل أي من الصور أو كس.يبدو القضبان تحاول تحميل ملفات كس دون سلسلة معرف ، على الرغم من أن في مجلد الأصول لديهم هذه السلسلة.ما هو غريب هو أن جس يبدو لتحميل بخير.

المصدر الأصلي:

<!-- Always force latest IE rendering engine or request Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">

<!-- Use title if it's in the page YAML frontmatter -->
<title>1</title>

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">

<!-- Stylesheets -->
<%= stylesheet_link_tag "application" %>

<!--csrf meta tags-->
<%= csrf_meta_tag %>

<!-- Jquery -->
<script src="//code.jquery.com/jquery.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

<!--default javascript-->
<%= javascript_include_tag "application" %> 

المصدر في المتصفح:

<!-- Always force latest IE rendering engine or request Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">

<!-- Use title if it's in the page YAML frontmatter -->
<title>1</title>

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">

<!-- Stylesheets -->
<link href="/stylesheets/application.css" media="screen" rel="stylesheet" />


<!--csrf meta tags-->
<meta content="authenticity_token" name="csrf-param" />
<meta content="+wxNNUVYmfRwayYxYOfVLWUEpm+iTH5BZN4Puluebh0=" name="csrf-token" />

<!-- Jquery -->
<script src="//code.jquery.com/jquery.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

<!--default javascript-->
<script src="/assets/application-e5001548de09f8867b4c904b1630d600.js"></script>

التكوين:

FwnApp::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 = false

# 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

# 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

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(:default, Rails.env)

module FwnApp
  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
  end
end

تطبيق المغلق

/*
*= require_self
*= require_tree .
*/ 

تطبيق رب

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(:default, Rails.env)

module FwnApp
  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
  end
end
هل كانت مفيدة؟

المحلول

تعيين إلى true:

config.serve_static_assets = true
config.assets.compile = true

إذا كنت لا تزال لا تعمل ، شارك application.rb و application.css الملفات.

تحرير

لإضافة ملفات كس مختلفة لديك خياران:

  1. إضافتها إلى application.css بيان.
  2. في application.rb: config.assets.precompile += ['application.css', 'other.css']

أقترح عليك أن تقرأ القضبان أدلة لفهم كيفية عمل خط أنابيب الأصول.

لإضافتها اعتمادا على الصفحة ، في تخطيط التطبيق:

التطبيق.أتش تي أم أل.هامل

...
= yield :css if content_for?(:css)
...

ثم في أي رأي:

رأي.أتش تي أم أل.هامل

- content_for :css do
  stylesheet_link_tag 'other'

تأكد من إضافة other.css كما هو الحال في 2.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top