I have defined a helper function inside the config.rb file. When I use it elsewhere, it works fine. But I have to use that function inside the config.rb as well simultaniously. Unfortunately there is an error:
`method_missing': undefined method `slug' for #<Middleman::ConfigContext:0xa137b44> (NoMethodError)
Is it nevertheless possible to access a function inside the helpers in config.rb file? Or do I have to declare the function outside globally and then access it from both inside the helper function and somewhere else in the file?
I was able to get this working by requiring my helper and including the module like this in config.rb:
require 'helpers/slugify_helper'
include SlugifyHelper
Then I was able to call my helper method from config.rb like: slugify(url)
.
FYI: I'm running Middleman ~> 4.2.1
.