Get started

To get started with websmith.js you need one file

The configuration file tells the library what the basic structure and content of the website is going to be.

{
  "title": "my website",
  "build": "./build",
  "assets": ["./themes/default/assets"],
  "navbar": {
    "name": "My New Website",
    "items": [{
      "link": "index.html",
      "name": "Home"
    }]
  },
  "layouts": "./themes/default/layouts",
  "pages": [
    {
      "name": "index.html",
      "desc": "Some catch phrase goes here",
      "body": "The content of the body",
      "layout": "home"
    }
  ],
  "footer": "Copyright © year author."
}

In this example above, we can see how websmith.js works:


Custom templates

Custom templates can be easily used by specifying the proper assets and layouts directories. They are based on the ETA templating engine and each field defined in the template must be matched by the corresponding entry in the configure file

  ...
  <div class="page-header">
    <img src="<%= it.logo %>" style="height: 1em;"></h1>
  </div>
  ...
{
  "pages": [
    ...
    {
      ...
      "logo": "assets/img/logo.png"
    }
  ]
}