css - 应用程序不读取样式表

标签 css ruby-on-rails ruby sass

我的应用程序只读取我的 application.css.scss 样式表,我希望在应用程序中读取其他样式表。以前没遇到过这个问题。我尝试使用以下扩展名(.css.scss 和 .css)重命名其他样式表,并尝试了我的 gem 的不同变体,但似乎没有任何效果。这是我当前的样式表:

application.css.scss
static_pages.scss
users.scss

gem 文件:

gem 'pg',           '0.17.1'
gem 'rails',        '4.2.2'
gem 'puma',         '3.4.0'
gem 'sass-rails',   '4.0.3'
gem 'uglifier',     '3.0.0'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks',   '2.3.0'
gem 'jbuilder',     '2.2.3'
gem 'bootstrap-sass',       '3.2.0.0'
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'devise'
gem 'devise_security_extension'

group :development, :test do
  gem 'pg',             '0.17.1'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'

结束

group :production do
  gem 'pg',             '0.17.1'

end

应用样式表:

/*
 * 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
 */


@import "bootstrap-sprockets";
@import "bootstrap"
;

最佳答案

看起来您的应用程序 文件是一个scss 文件。 所以您需要使用 @import 导入文件。

@import "bootstrap-sprockets";
@import "bootstrap";
@import "static_pages";
@import "users";

关于css - 应用程序不读取样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38295663/

相关文章:

ruby-on-rails - Jekyll 液体异常 : Cannot find/bin/sh on Windows

ruby-on-rails - 有没有办法将 Paperclip 中的扩展程序列入黑名单?

ruby-on-rails - 在 Rails 中渲染 JSON

html - 如何将表格中的肖像更改/裁剪为风景图像?

javascript - 使用 CSS 和 HTML 的垂直树

css - 使用整个图片作为 div 标签的边框

ruby-on-rails - 如何使用 Liquid 模板语言在布局中渲染模板?

html - 没有 CSS 框架的媒体查询

ruby - block 前的 Sinatra/Rack params[]

ruby - 使用 Ruby 重定向后如何获取最终 URL?