我无法在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功能。我究竟做错了什么?
最佳答案
这项工作对我来说。
!!!
:javascript
alert('oi');
%asp:TextBox#teste
= Haml::Engine.new(File.read(File.dirname(__FILE__)+'\include_file.haml')).render
#outro
= File.dirname(__FILE__)
请注意,如果使用此技术对包含文件进行任何更改,Prepros不会“自动”更新使用包含文件的文件。这需要您自己动手完成。
关于ruby-on-rails - Prepros App中的HAML渲染-错误还是我?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17835347/