gpt4 book ai didi

ruby-on-rails - Prepros App中的HAML渲染-错误还是我?

转载 作者:行者123 更新时间:2023-12-02 11:05:12 27 4
gpt4 key购买 nike

我无法在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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com