4

twitter-bootstrap-rails gemをアセットパイプラインと適切に統合するにはどうすればよいですか?

インストール手順を実行しましたが、現在このapplication.cssがあります

 *= require_self
 *= require bootstrap_and_overrides

そして、bootstrap_and_overrides.css.lessで、オーバーライドファイルで定義された変数で機能させ、ファイル内のコントローラー固有のスタイルシート内でブートストラップミックスインを使用できるようにするために、他のコントローラースタイルシートをインポートしてい<controller-name>.css.lessます。現在、私はこれを行っています:

# in bootstrap_and_overrides.css.less
// generated code ...
// Your custom LESS stylesheets goes here
//
// Since bootstrap was imported above you have access to its mixins which
// you may use and inherit here
//
// If you'd like to override bootstrap's own variables, you can do so here as well
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
//
// Example:
// @linkColor: #ff0000;
@linkColor: #ff0000;

// import all other stylesheets
@import 'home.css.less';
@import 'users.css.less';
// and so on, once for every controller

// in home.css.less
#foobar {
    .border-radius(30px); // bootstrap mixin
    color: @linkColor;    // inherited variable 
}

ただし、このようにしてアセットパイプラインが失われ、開発モードで個々のスタイルシートを表示できなくなります。twitter-bootstrap-railsをスプロケットで動作させる方法はありますか?

4

1 に答える 1

5

githubのこの問題があなたの質問を説明していると思います。(私はそれがサスのためであることを知っています、しかし説明はとにかく有効であるはずです)

つまり、スプロケットを使用すると、各ファイルが個別にコンパイルされます。つまり、Twitterブートストラップフレームワークで定義された変数とミックスインを使用することはできません。だから私は答えはノーだと思います:)

于 2012-04-23T14:50:33.260 に答える