leviwheatcroft / metalsmith-debug-ui

browser based ui for metalsmith debugging
21 stars 3 forks source link

How to use it in metalsmith.json? #8

Closed maximelebreton closed 5 years ago

maximelebreton commented 5 years ago

Hello, how can I use it in metalsmith.json?

When I try to using it like a classic plugin

{
    "source": "src/pages/",
    "destination": "dist/",
    "clean": false,
    "plugins": {
      "metalsmith-debug-ui": {}
    }
}

It throws an error: mod is not a function

Thanks!

leviwheatcroft commented 5 years ago

Sorry metalsmith-debug-ui won't work with json mode in the same way as other plugins.

As a workaround you could try a custom plugin to patch the metalsmith instance. I haven't tried this and honestly not sure if it will work.

debugUiPatch.js:

var debugUi = require('metalsmith-debug-ui')

module.exports = function (metalsmith) {
  debugUi.patch(metalsmith)
}

Then in metalsmith.json

{
    "source": "src/pages/",
    "destination": "dist/",
    "clean": false,
    "plugins": {
      "./debugUiPatch.js": {}
    }
}

In any case, I'll update the readme to say that this plugin isn't compatible with metalsmith.json mode.