Is it possible to use Handlebars in a CMS landing ...
# suitecommerce
m
Is it possible to use Handlebars in a CMS landing page? It could greatly simplify updating a page I touch maybe twice a year.
s
Not unless you want to create your own landing page type
c
Have you tried injecting some JS in the page to see if you can do the update that way? I don't think handlebars will work that way.
m
@Chris I tried the basic inline script inclusion, and including the script in the head (through the advanced page option) but can't seem to get access to the Handlebars global object.
Sounds like I may be on a path to try Steve's suggestion...
c
At CMS render time the page is pretty much done being built. The JS would just do straightforward DOM object manipulation.
s
get access to the Handlebars global object
require('Handlebars')
?
c
Not high tech stuff.
m
I figured out one solution. The shopping code bundle includes the handlebars runtime but not the compiler. I imagine this is because all templates are compiled at build time. But it was straight-forward to change the third party
ns.package.json
and
distro.json
to bundle the full lib. It's now trivial to compile Handlebars templates within script tags of CMS landing pages.
👏 1
👏🏻 1