How can helpers be accessed from Middleman Console

有些话、适合烂在心里 提交于 2019-12-11 06:35:45

问题


How can helpers be accessed from middleman console? Answer for both 3.x and 4.x would be helpful if it's not the same object path.


回答1:


I couldn't find any documentation on this, so settled for the following work around:

Here's my helper

module PageHelpers
  def thing
    "THING!"
  end
end

Call the helper method on an instance of a class that includes it:

$ bundle exec middleman console
irb...> (class Thing; include PageHelpers; end).new.thing
=> "THING!"


来源:https://stackoverflow.com/questions/42144577/how-can-helpers-be-accessed-from-middleman-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!