试图在heroku上通过bootstrap-sass导入bootstrap,但遇到错误 [英] trying to import bootstrap via bootstrap-sass on heroku but getting an error

查看:129
本文介绍了试图在heroku上通过bootstrap-sass导入bootstrap,但遇到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个rails应用程序,并试图用bootstrap-sass按照以下指令导入heroku上的bootstrap: https://github.com/thomas-mcdonald/bootstrap-sass



在我的application.css中,我有:

  @importbootstrap; 
/ *
*这是一个将被编译到application.css中的清单文件,它将包含下面列出的所有文件
*。
*
*此目录下的任何CSS和SCSS文件,lib / assets / stylesheets,vendor / assets / stylesheets,
*或者vendor / assets / stylesheets的插件这里使用相对路径引用。
*
*您可以自由地将应用程序范围的样式添加到此文件中,并且它们将出现在
*编译文件的顶部,但创建新文件通常会更好每个样式范围。
*
* /

@importoverrides.css.scss;

但是当我 git push heroku master

  ----->为Rails资产管道准备应用程序
运行:rake资产:预编译
rake中止!
导入未找到或无法读取的文件:bootstrap。
加载路径:/ tmp / build_8elam02dzb95
(在/tmp/build_8elam02dzb95/app/assets/stylesheets/application.css)
(sass):1
/ tmp / build_8elam02dzb95 / vendor / bundle / ruby​​ / 1.9.1 / gems / sass-3.2.7 / lib / sass / tree / import_node.rb:67:in`rescue in import'
/ tmp / build_8elam02dzb95 / vendor / bundle / ruby /1.9.1/gems/sass-3.2.7/lib/sass/tree/import_node.rb:45:in`import'
/tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/ sass-3.2.7 / lib / sass / tree / import_node.rb:28:在`imported_file'中
/tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib /sass/tree/import_node.rb:37:in`css_import?'
/tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors /perform.rb:217:in`visit_import'
/tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb: 37:在'visit'
/tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/li b / sass / tree / visitors / perform.rb:100:在`visit'

我是什么做错了?

编辑#1
输出显示bootstrap-sass已安装

  -----> Ruby / Rails应用程序检测到
----->使用Bundler版本1.3.2安装依赖项
运行:bundle install - 无需开发:test --path vendor / bundle --binstubs vendor / bundle / bin --deployment
使用rake(10.0.3)
使用i18n(0.6.4)
使用multi_json(1.6.1)

....
使用sass(3.2.7)
使用bootstrap-sass(2.2.2.0)
使用coffee-script-source(1.6.1)


解决方案

这是一段时间,所以不知道这是否仍然相关。看起来你的application.css应该被命名为application.css.scss,这样它就会被Sass处理。否则,正常的CSS @import指令不会知道Sass Bootstrap。


I have a rails app and am trying to import bootstrap on heroku with bootstrap-sass following the directions from here: https://github.com/thomas-mcdonald/bootstrap-sass

In my application.css, I have:

@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 vendor/assets/stylesheets of plugins, if any, 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 top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 */

@import "overrides.css.scss";

but am getting the following error when I git push heroku master.

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       File to import not found or unreadable: bootstrap.
       Load path: /tmp/build_8elam02dzb95
       (in /tmp/build_8elam02dzb95/app/assets/stylesheets/application.css)
       (sass):1
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/import_node.rb:67:in `rescue in import'
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/import_node.rb:45:in `import'
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/import_node.rb:28:in `imported_file'
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/import_node.rb:37:in `css_import?'
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:217:in `visit_import'
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/base.rb:37:in `visit'
       /tmp/build_8elam02dzb95/vendor/bundle/ruby/1.9.1/gems/sass-3.2.7/lib/sass/tree/visitors/perform.rb:100:in `visit'

What am I doing wrong?

edit #1 output showing bootstrap-sass is installed

-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       Using rake (10.0.3)
       Using i18n (0.6.4)
       Using multi_json (1.6.1)

       ....
       Using sass (3.2.7)
       Using bootstrap-sass (2.2.2.0)
       Using coffee-script-source (1.6.1)

解决方案

It's been a while so not sure if this is still relevant. It appears that your application.css should have been named application.css.scss so that it will be processed by Sass. Otherwise the normal CSS @import directive would not be aware of Sass Bootstrap.

这篇关于试图在heroku上通过bootstrap-sass导入bootstrap,但遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆