我无法在HAML中包含分部文件才能工作。
我有一个来自基本HAML测试的代码
# file: partial_layout.haml
%h1 Partial layout used with for block:
= render :layout => 'layout_for_partial' do
%p Some content within a layout和第二个文件
# file: _layout_for_partial.haml
.partial-layout
%h2 This is inside a partial layout
= yield所以我点击了Prepros App中的编译按钮...
Exception on line 2: undefined method `render' for #<Object:0x2a196c8>
Use --trace for backtrace.
D:\Download\haml-master\haml-master\test\templates\partial_layout.haml这应该是基本的HAML函数。我做错了什么?
发布于 2013-08-04 06:37:50
这对我很有效。
!!!
:javascript
alert('oi');
%asp:TextBox#teste
= Haml::Engine.new(File.read(File.dirname(__FILE__)+'\include_file.haml')).render
#outro
= File.dirname(__FILE__)请注意,如果您使用此技术对包含文件进行任何更改,Prepros不会“自动”更新使用包含文件的文件。这需要靠你自己的双手来完成。
发布于 2014-01-13 09:10:50
这不是一个确切的答案,但是如果你切换到Jade (它非常类似于HAML),它支持include (用于部分)和extends用于子模板,只是使用Prepos。
https://stackoverflow.com/questions/17835347
复制相似问题