HaoZeke
HaoZeke

Reputation: 788

Viewing the metalsmith pipeline JSON

Metalsmith has an inbuilt way of displaying the pipeline contents, namely by using a simple function like:

    function(files, ms, done) {
        console.log('Files: ');
        console.log(files);
        console.log();
        console.log('Metalsmith ');
        console.log(ms);
        done();
    }

Or with metalsmith-logger

logger(['title', 'tags', 'contents')

However in both cases I get the output as [object Object] and I require the full output. (i.e what I might get with JSON.stringify)

Even more so though, I wonder if there's any way to get a nicely formatted output of the pipe and contents after each transform, like one gets using gatsbyjs and graphQL.

Upvotes: 0

Views: 114

Answers (2)

H.Houssein
H.Houssein

Reputation: 23

You can print out the object contents by using JSON.stringify() to wrap the files and ms like this JSON.stringify(files,null,3) where 3 is the depth number of the object

Upvotes: 1

Jake Rayson
Jake Rayson

Reputation: 921

Would metalsmith-debug-ui help? Nicely formatted React tool…

Upvotes: 1

Related Questions