The way you have that code indented, it looks like you're trying to render content into the %h2
I'm not sure what markup you're expecting, but with haml, indentation means inclusion. Are you trying to render this? <h2>Footer Lorem Ipsum<div>Content from footer/_foo.html</div></h2> Or are you trying to render this? <h2>Footer Lorem Ipsum</h2><div>Content from footer/_foo.html</div> If you want the latter, simply un-indent your render call. %h2 Footer Lorem Ipsum = render :partial => "footer/_foo.haml" Haml itself doesn't provide any mechanism for "partials" When using Haml from within Rails, the render method call is handled by ActionView. I haven't used CodeKit before, but apparently it isn't providing this method for partial inclusion. It looks like there's an old GitHub/haml-contrib thread about accessing this functionality in CodeKit (https://github.com/haml/haml-contrib/issues/1) so that might serve as a good jumping-off point for getting at the functionality you need. Best, Duncan On Thu, Aug 1, 2013 at 2:53 PM, Eric <[email protected]> wrote: > Hello again, > > Basically, I was wondering if it was possible to render partials in HAML, > like with SASS's @import functionality for a local, static site. > > The code is: > > %h2 Footer Lorem Ipsum >> >> = render :partial => "footer/_foo.haml" >> >> > With the file "_foo.haml" located in the folder footer. _foo.hamlcontains > valid HAML (rendered properly, then cut and pasted out of the > index and into the new partial document). > > I'm using CodeKit to render my HAML, and receive one of the two error > messages, depending on whether or not I indent with a tab: > > undefined method `render' for #<Object:0x10c4ce1d8> >> > > or > > Illegal nesting: content can't be both given on the same line as %h2 and >> nested within it. >> > > Is there something obvious I'm missing out on? And sorry if this reads > weird. I've done a little searching on Google/Stack Exchange, I'm not a > programmer by trade/don't know Ruby, and I'm a little shaky on the right > terminology, so I'm not 100% if I'm phrasing the searches properly. > > -- > You received this message because you are subscribed to the Google Groups > "Haml" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/haml. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Haml" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/haml. For more options, visit https://groups.google.com/groups/opt_out.
