西兰花炖菜没有任何东西可以打印

时间:2017-11-20 00:09:11

标签: javascript ember.js broccolijs

我尝试使用西兰花炖菜(或西兰花调试)来调试我的树,因为我不确定它是否将正确的文件移动到正确的位置。 当我使用app.import('vendor/my-app/file.css');导入时,它会给我一个错误...我想查看我的节点

我尝试在treeForVendor()上使用,但它没有做任何事情。

var Funnel = require('broccoli-funnel');
var MergeTrees = require('broccoli-merge-trees');
var log = require('broccoli-stew').log;

module.exports = {
    ...
    treeForVendor(vendorTree) { 
        var f = new Funnel(...);
        // here is the problem
        log(f, { output: 'tree', label: 'my-app tree'});
        // I don't want to print using console.log(f); 
        return new MergeTrees([vendorTree, f]);
    }
    ...
}

1 个答案:

答案 0 :(得分:2)

您需要使用log函数返回的值并将其传递给您返回的合并树,以便将树打印到控制台:

var Funnel = require('broccoli-funnel');
var MergeTrees = require('broccoli-merge-trees');
var log = require('broccoli-stew').log;

module.exports = {
    ...
    treeForVendor(vendorTree) { 
        var f = new Funnel(...);
        var loggedTree = log(f, { output: 'tree', label: 'my-app tree'});
        return new MergeTrees([vendorTree, loggedTree]);
    }
    ...
}