I just used good old google to find all kinds of discussions about this over the years, no one seems to have come to a solution.
The reason many people have asked about this is because these provide basic but useful functionality to handlebars. Many of them are not available at all otherwise, and for those that are, the ghost way is an ugly code kluge that makes for hard to maintain hbs files. No one wants to make 20-block if/else statements
I have seen the docs you linked. I see there are instructions on how to make one’s own helpers for ghost. It seems lots of people ask about these helpers.
So one solution is to port these to be custom ghost helpers. Probably doable by someone. Since the list hasn’t changed in a long time, maybe there is an argument to doing this and adding it to core ghost.
But that means if this npm package ever does change, someone will have to both notice and upgrade ghost. I don’t want to do that for my own project, and probably no other developer does either. If it is part of core, then at least we all benefit from one person doing it.
Another approach might be this, let me know what you think:
1 - install the helper package via npm to node_modules the standard way as I did
2 - modify gulpfile.js to see if the package is installed, if so, copy it to the folder where ghost wants custom folders to be
3 - modify core to see if these “custom” helpers are there, if they are register them the ghost way
The advantages to this are:
1 - it will pick up changes at the npm level meaning ghost developers will be using the original code in a ghost context, even of the package managers update the code
2 - the code changes to core are minimal and probably will only ever need to change if the list of helpers changes
3 - if the package is not installed, there is no change to ghost behavior or functionality
4 - it will “just work” if you install the package (there might need to be some decisions if there are helper name conflicts between ghost and the package, but that seems easy to fix, maybe by registering the names with a prefix
5 - this would provide a path forward for using other npm handlebars helper modules, and also for sharing custom modules among theme developers.
I need to move my project forward to alpha status asap so I am not going to do this immediately, but there will be a time when I need to refactor some stuff and if you think this will work, I might do the work and if I do get it to work, I would be interested in creating a pull request to get it into core because it’s a frequently asked feature request.
And maybe someone else will see this and give it a spin before I get to it.
Do you think this approach will work, and if it does it can be considered for core?