导入"bootstrap"时Ruby on Rails错误

 px9ctrl 发布于 2023-01-15 19:27

我是ruby on rails的新手,目前正在关注Michael Hartl的教程,不幸的是当我尝试@import "bootstrap";在custom.css.scss文件中调用时,第五章陷入困境.

我收到以下错误:

Sprockets::Rails::Helper::AssetFilteredError in StaticPages#home
  Showing /Users/name/Documents/Rails_projects/sample_app/app/views/layouts    /application.html.erb where line #5 raised:
Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( glyphicons-halflings.png )` to `config/initializers/assets.rb` and restart your server
      (in /Users/name/Documents/Rails_projects/sample_app/app/assets/styleshee
/custom.css.scss)
     Extracted source (around line #5):

line 5:    stylesheet_link_tag    "application", media: "all"

梳理了互联网后,我尝试了以下解决方案,其中没有一个有效

    上面提供的assets.rb文件的建议

    使用control + c重新启动服务器

    将gem文件'bootrap-sass'移动到gem文件中的部分,以获取产品中不需要的资产

    将application.css文件的扩展名更改为application.css.scss

    直接调用@import"bootstrap"; 在application.css.scss文件中

    添加到config.ru以下内容:require'bootstrap-sass'#requirest of bootstrap-sass

这些都是我在网上找到的解决方案,但都没有.

感谢任何帮助!

谢谢!

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有