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

标签 ruby-on-rails compiler-errors haml

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

相关文章:

css - 为 link_to 链接中的某些词应用 CSS

css - 引用 Assets 供应商目录中的图像 url

javascript - 如何合并多个 css、js 文件并在 rails 3 中作为一个文件使用?

ruby-on-rails - 在 ruby​​ 中过滤事件记录结果

ruby-on-rails - ruby rails : A way to save currency into a column within a database-table

iphone - ';' token 错误之前预期的 '('

c++ - 编译时体系结构x86_64错误的 undefined symbol

webpack - 如何防止webpack在加载程序的每个错误上打印较长的文件列表(在多文件条目中)

javascript - 将变量值注入(inject) RoR 中的 javascript 和 HAML

jquery - 茧/jQuery : append items to relevant table