Reputation: 2464
I'm writing a middleman extensions but having trouble re-using the render_partial
method with an erb file path outside of the main application.
Trying to do so always gives me the error
Cannot locate partial ...
I believe this is because it only accepts relative paths from the application root.
Is there a way i can render partials with absolute paths in Middleman?
I can get around the issue by requiring Erb and doing my own rendering however I'm really keen to keep the Middleman Context
when rendering my extension partials.
Any help greatly appreciated.
EDIT
It turn's out this is not currently possible with Middleman v4. This line of code will only resolve relative file paths.
My work around was to write my own mini helper class that utilises ERB to render partials from absolute paths. I was able to keep the Middleman template context by using delegates on the @app instance.
Upvotes: 1
Views: 1071
Reputation:
try using this instead of render_partial
<%= partial 'partial/yourpartialname' %>
where yourpartialname should be in the format of _yourpartialname.html.erb
Hope this helps :)
Upvotes: 2