【问题标题】:app not reading stylesheets应用程序不读取样式表
【发布时间】:2016-07-11 17:22:40
【问题描述】:

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

application.css.scss
static_pages.scss
users.scss

宝石文件:

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"
;

【问题讨论】:

    标签: css ruby-on-rails ruby sass


    【解决方案1】:

    看起来您的 application 文件是一个 scss 文件。 因此您需要使用@import 导入文件。

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

    【讨论】:

      猜你喜欢
      • 2012-04-04
      • 1970-01-01
      • 2017-09-04
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-03
      相关资源
      最近更新 更多