【问题标题】:Viewing the metalsmith pipeline JSON查看 metalsmith 管道 JSON
【发布时间】:2023-04-03 07:24:01
【问题描述】:

Metalsmith 有一种显示管道内容的内置方式,即使用一个简单的函数,例如:

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

或者metalsmith-logger

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

但是,在这两种情况下,我都得到了[object Object] 的输出,并且我需要完整的输出。 (即我可以用 JSON.stringify 得到什么)

更重要的是,我想知道是否有任何方法可以在每次转换后获得格式良好的管道和内容输出,就像使用 gatsbyjs 和 graphQL 一样。

【问题讨论】:

    标签: json metalsmith


    【解决方案1】:

    metalsmith-debug-ui 会帮忙吗?格式精美的 React 工具……

    【讨论】:

    • 它看起来很完美,但还不能与 gulp-metalsmith 一起使用
    【解决方案2】:

    您可以使用JSON.stringify()filesms 像这样JSON.stringify(files,null,3) 包裹起来打印出对象内容,其中3 是对象的深度数

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-19
      • 2017-08-06
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-18
      • 1970-01-01
      相关资源
      最近更新 更多