Rails css资产管道不拉入其他样式表。

Rails css资产管道不拉入其他样式表。,css,ruby-on-rails,twitter-bootstrap,asset-pipeline,Css,Ruby On Rails,Twitter Bootstrap,Asset Pipeline,因此,我正在构建一个应用程序&我添加了bootstrap sassgem。以下是我的gemfile的外观: gem 'rails', '4.2.6' gem 'bootstrap-sass' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2

因此,我正在构建一个应用程序&我添加了
bootstrap sass
gem。以下是我的gemfile的外观:

gem 'rails', '4.2.6'
gem 'bootstrap-sass'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'bcrypt', '~> 3.1.7'

group :development, :test do
  gem 'byebug'
  gem 'sqlite3',  '1.3.11'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

group :production do
    gem 'pg'
end
我的路线文件夹:

Rails.application.routes.draw do
  root 'landing_page#home'
  get 'users/new'
end
我有两个样式表
application.scss
landing\u page.scss

我只是在尝试设计我的登录页面。但是,我无法从我的
登录页面.scss
加载任何样式。我只能将这些样式放置在
application.scss
中才能加载

这里是
application.scss

 @import "bootstrap-sprockets";
 @import "bootstrap";
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self
 */


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

.debug_dump {
  clear: both;
  float: left;
  width: 100%;
  margin-top: 45px;
  @include box_sizing;
}

body{
  background-color: #525252;
}

有人知道我做错了什么吗?为什么放置在
登录页面.scss
中时没有应用sass或纯css

您想导入部分sass文件。查看以了解partials是如何工作的


在您的情况下,您应该将
landing\u page.scss
重命名为
\u landing\u page.scss
,并在
application.scss
文件中执行
@import landing\u page

我完全理解partials的功能,现在让我的应用程序正常工作,非常感谢!我对为什么必须导入此样式表感兴趣,我认为它最初是资产管道的一部分。或者是因为sass的实施?您是否在问为什么
登录页面.scss
不包括在
应用程序中。scss
?Sprocket(或资产管道)读取清单文件以构建单个css或js文件。默认情况下,清单文件为application.css或application.scss。因此,您需要导入(或包含)其他css代码段,以便对其进行处理。看见它回答了你的问题吗?