Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css Rails应用程序中的样式表范围不正确_Css_Ruby On Rails_Ruby On Rails 4_Sprockets_Ruby 2.0 - Fatal编程技术网

Css Rails应用程序中的样式表范围不正确

Css Rails应用程序中的样式表范围不正确,css,ruby-on-rails,ruby-on-rails-4,sprockets,ruby-2.0,Css,Ruby On Rails,Ruby On Rails 4,Sprockets,Ruby 2.0,我有我的主应用程序css,我想排除我的后端样式表,因为当application.css执行时,所有样式都会溢出*=require\u tree. 我目前的文件夹设置如下: assets/ stylesheets/ main/ #application.css ##other css files for front end backend/ #backend.css ##other css files for back end My application

我有我的主应用程序css,我想排除我的后端样式表,因为当application.css执行时,所有样式都会溢出
*=require\u tree.

我目前的文件夹设置如下:

assets/   
   stylesheets/
       main/ #application.css ##other css files for front end
       backend/ #backend.css ##other css files for back end
My application.css如下所示:

/*
*= require_self
*= require foundation_and_overrides
*= require_tree ./main/
*/
backend.css

/*
 *= require_self
 *= require foundation_and_overrides
 *= require_tree ./backend/
 */
在我的application.rb中

config.assets.precompile += ['application.css', 'backend.css']
我的发展.rb

 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 = true
我尝试移动样式表并使用不同的目录,但我要么根本不加载样式表,要么接收“找不到基础和覆盖”


有没有一种简单干净的方法可以做到这一点我只想从应用程序编译中排除几个样式表。css

链轮的全部要点是包含您需要的内容。您始终可以将另一个样式表作为一个整体添加到页面中。与用户一起编译成一个样式表是一种很好的做法,但如果管理员使用后端,则添加另一个样式表完全可以

首先,
application.css
已经预编译,所以您只需要:

config.assets.precompile << 'backend.css'
如果由于某种原因,
应用程序.css
样式与
后端.css
样式冲突,您还可以为这两种样式表添加一个
共享的
目录

+ stylesheets
  + shared
  + app
  + backend
  - application.css
  - backend.css
require_tree./shared

+ stylesheets
  + shared
  + app
  + backend
  - application.css
  - backend.css