質問

私はRailsが真新しいです。ここで説明するように、Zurb Foundationのフロントエンドフレームワークをインストールしました。 http://www.zurb.com/article/814/yetify-your-rails-new-foundation-gem and-

App/Assets/StyleSheets/Application.cssを開くと、この自動生成コードが見つかります。

/*
* This is a manifest file that'll automatically include all the stylesheets available in      this directory
* and any sub-directories. 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.
*= require_self
*= require foundation
*= require_tree . 
*/

しかし、私の見解ではこの行

<%= stylesheet_link_tag    "application" %>

ファイルzurb_foundation/app/assets/styleSheets/foundation/index.css私が作成したことはありません。

couldn't find file 'foundation'
(in /Users/migu/railsapps/maneki1/app/assets/stylesheets/application.css:6)

Zurb_Foundation/App/Assets/StyleSheets/Foundation/の下に置いたファイルとすべてのCSSファイルをロードするにはどうすればよいですか?ありがとう...

役に立ちましたか?

解決

RailsがZurb-Foundation GEMから新しい資産を取得する前に、Webサーバーを再起動する必要があります。再起動したら、機能するはずです。

また、Zurb-FoundationアセットがRailsコンソールから正しく見つかっていることを確認できます。コマンドプロンプトで、「Rails C」を入力し、次に「Rails.Application.Config.Assets.Paths」を入力します(両方とも引用符を引いたコマンド)。あなたは次のようなものを見るはずです:

=> ["/Users/MYUSER/appPath/app/assets/images", "/Users/MYUSER/appPath/app/assets/javascripts", "/Users/MYUSER/appPath/app/assets/stylesheets", "/Users/MYUSER/appPath/vendor/assets/stylesheets", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/jquery-rails-1.0.19/vendor/assets/javascripts", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/zurb-foundation-2.1.0/vendor/assets/images", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/zurb-foundation-2.1.0/vendor/assets/javascripts", "/Users/MYUSER/.rvm/gems/ruby-1.9.3-p0/gems/zurb-foundation-2.1.0/vendor/assets/stylesheets"] 

注意して、生産時に資産を展開するために追加の作業を行う必要があるかもしれません。

他のヒント

このスレッドに基づいて同様の問題を解決する方法は次のとおりです https://github.com/zurb/foundation/issues/834gemfileにコンパスレールジェムを追加しました:

group :assets do
  gem 'compass-rails'

走る:

bundle install

ウェブサーバーを再起動することを忘れないでください、そして魔法が起こります。

この指令をあなたに追加できます application.css ファイル:

 *= require_directory ./foundation

または、を使用できます foundation-rails 宝石。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top