isari
isari

Reputation: 43

Metalsmith layouts causes "no files to process" error

I conscientiously followed the tutorial on official community driven docs but failed to compile project on using Handlebars and metalsmith-layouts. "Metalsmith · no files to process" error occurred.

Here is my directory structure:

.
├── src
│   └── index.html
├── templates
│   └── main.hbs
└── build.js

build.js:

const Metalsmith = require('metalsmith');
const layouts = require('metalsmith-layouts');

Metalsmith(__dirname)
    .source('./src')
    .destination('./docs')
    .use(layouts({
        engine: 'handlebars',
        directory: 'templates'
    }))
    .build(function (err) {
        if (err) {
            throw err;
        }
    });

and main.hbs:

<h1>{{title}}</h1>

<p>
    {{contents}}
</p>

Upvotes: 4

Views: 340

Answers (1)

HelloWorld101
HelloWorld101

Reputation: 4366

This is because metalsmith-layouts uses jstransformers.

You need to install jstransformer-handlebars in order to fix the error you encountered.

Run $ npm install --save jstransformer-handlebars and try again.

Upvotes: 2

Related Questions