2

Railsアプリがあり、ここからの指示に従ってbootstrap-sassを使用してherokuにブートストラップをインポートしようとしています: https://github.com/thomas-mcdonald/bootstrap-sass

私のapplication.cssには、次のものがあります。

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

しかし、次のときに次のエラーが発生します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'

私は何を間違っていますか?

#1 の出力は、bootstrap-sass がインストールされていることを示しています

-----> 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)
4

2 に答える 2

1

しばらく経っているので、これがまだ関連しているかどうかはわかりません。Sass によって処理されるように、application.css は application.css.scss という名前にする必要があるようです。そうしないと、通常の CSS @import ディレクティブは Sass Bootstrap を認識しません。

于 2013-08-29T15:45:20.827 に答える
0

application.css の名前を変更するのではなく、custom.css.scss という名前の新しいファイルを作成することをお勧めします。

@import "ブートストラップ";

そこの。また、gemfile にsass-rails gem があることを確認してください。
上記の構成は私にとってはうまく機能しています。そして私のapplication.cssは次のようになります:

*
*= require_self
*= require_tree .
*/
于 2013-09-04T16:30:07.420 に答える