dadi / web

Web is a drop in front end for websites and web apps. Consumes data from DADI API and others
https://dadi.cloud/en/web/
Other
48 stars 16 forks source link

CLI not installing Handlebars engine #357

Open krinapandya opened 6 years ago

krinapandya commented 6 years ago

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.

eduardoboucas commented 6 years ago

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:

  1. Install the Handlebars engine as a dependency

    npm install @dadi/web-handlebars --save
  2. Change your server.js file to:

    require('@dadi/web')({
      engines: [
        require('@dadi/web-handlebars')
      ]
    })
  3. Remove the contents of your workspace/pages directory 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.

eduardoboucas commented 6 years ago

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!