2

アプリケーションGemfilegem'haml '内に書き込むことなく、gem内でHamlテンプレートを使用できますか?

my_gem.gemspecファイルに次の行を入力します。

s.add_runtime_dependency "haml", "~> 3.0"

my_gemフォルダーのGemfileに次の行を追加します。

gem 'haml', '~> 3.0'

私は:バンドルし、Hamlは現時点でインストールしますが、機能しません。

Template is missing
Missing template layouts/my_gem with {:handlers=>[:erb, :builder, :coffee] }

アプリケーションGemfileで複製する場合のみ

gem'haml'、'〜> 3.0'

それはうまくいきます。

Gemfileに複製せずに、gemでHamlを使用できますか?

4

1 に答える 1

2

すべてのアプリケーション(エンジン)は、必要なすべてのgemを必要とします。たとえば、私にとっては次のようになります。

require "haml"

require "the_role/hash"
require "the_role/engine"
require "the_role/version"
require "the_role/the_class_exists"

module TheRole
  # some code here
end
于 2011-10-31T15:40:12.857 に答える