gpt4 book ai didi

ruby-on-rails - Assets 管道 - 无法让我的 CSS 生效

转载 作者:太空宇宙 更新时间:2023-11-03 16:05:42 26 4
gpt4 key购买 nike

我目前在使用 Ruby on Rails 上的 Assets 管道时遇到了一些问题。

我正在使用电子商务解决方案 (Spree),在文档中,文档中有这个:

[...] you can improve performance significantly by using a special precompile task.

$ bundle exec rake assets:precompile:nondigest

Using the precompile rake task in development will prevent any changes to asset files from being automatically included in when you reload the page. You must re-run the precompile task for changes to become available.

我的问题是,执行命令后,我的所有 CSS 都必须手动重新编译才能生效。我找不到为此的“反向”命令​​。

我尝试删除 public/assets 然后重启,但没有任何效果。

在我的 application.rb 中,我有这一行 Assets :

config.assets.enabled = true

编辑:我的开发.rb

Mystore::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

# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true

# 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

# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin

# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict

# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5

# Do not compress assets
config.assets.compress = false

# Expands the lines which load the assets
config.assets.debug = true
end

如果有人有线索,我很开放(:

谢谢

最佳答案

通常你可以运行:

$ bundle exec rake RAILS_ENV=development assets:clean

这应该会清除所有预编译的 Assets 。听起来您处于开发模式,但如果您处于生产模式,请删除 RAILS_ENV=development 部分。

关于ruby-on-rails - Assets 管道 - 无法让我的 CSS 生效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14361793/

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