web
web copied to clipboard
CLI not installing Handlebars engine
Hi,
We are trying to install handlebar as our templating engine while creating new web app from dadi cli. While creating new app (web) from dadi cli it asks for number of options where one of the options is to select template engine, no matter what we select as template engine it always installs dust as default engine. Upon further reading documentation, we also noticed a manual way to install template engines, but we are not sure as post installation it doesnt creates templates automatically. If any help in this direction can be given it will be appreciated as the web we are not able to move forward due to this.
Hi @ThinkDigitalWeb! Sorry to hear about your issue.
I'll investigate whether something is wrong on the DADI CLI side and will add any updates to this issue. In the meantime, I can certainly help you with the manual installation:
-
Install the Handlebars engine as a dependency
npm install @dadi/web-handlebars --save -
Change your
server.jsfile to:require('@dadi/web')({ engines: [ require('@dadi/web-handlebars') ] }) -
Remove the contents of your
workspace/pagesdirectory and add the following two files:index.json
{ "page": { "name": "index", "description": "An introduction to DADI Web." }, "settings": { "passFilters": true }, "routes": [ { "path": "/" } ] }index.hbs
<h1>Hello world</h1>
After doing this, you should see the Hello world template when you load your index route. From there, you can add more pages and partials using the same method.
Let me know if you find any issues in the process above.
Also, so that I can better understand what went wrong with your initial attempt, could you please share the contents of the package.json file that was generated by CLI, as well as the version of the CLI app (which you can obtain by running dadi -v)?
Thanks!