I’m upgrading from Middleman 3 to 4, in version 3 I could just use method names used in my helpers right inside of config.rb, but this doesn’t seem to work with version 4.
How do I access my helper methods inside config.rb in version 4?
Thanks
I’m upgrading from Middleman 3 to 4, in version 3 I could just use method names used in my helpers right inside of config.rb, but this doesn’t seem to work with version 4.
How do I access my helper methods inside config.rb in version 4?
Thanks
Did you find a solution? I am struggling with the same issue!
Something not clear in the use of the helpers folder.
CustomHelpers lives in helpers/custom_helpers.rb
If the file name is after the name of the module, shouldn’t this be named without the underscore?
It would be nice to get some clarification on this topic. I am currently duplicating the same function in my config.rb and in my helpers (for use in the config and in my templates, respectively).
I can confirm that at least in v4 the functions defined in the helper file are NOT accessible in the config.rb neither through the technique of require my_helpers
nor through automatic loading of things in the helper/
directory
For what it’s worth, this question is also floating around unanswered on Stack Overflow: http://stackoverflow.com/questions/42602311/middleman-use-custom-helper-function-inside-config-rb-file
FWIW, the documentation says:
In addition to the helpers provided by Middleman out of the box, you can also add your own helper methods and classes that will be accessible within any controller or view automatically.
The “automatic” feature isn’t available to the config file, you’d have to require your helpers into the config file as you would any other ruby file.