javascriptember.jsbroccolijs

Broccoli-stew doesn't print anything


I tried using broccoli-stew (or broccoli-debug) to debug my tree, because I'm not sure if it's moving the correct files to the right location. When I import with app.import('vendor/my-app/file.css'); it gives me an error... I want to see my nodes

I tried using on treeForVendor(), but it doesn't do anything.

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]);
    }
    ...
}

Solution

  • You need to use the value returned by the log function and pass it to the merged tree that you return in order to print the tree to the console:

    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]);
        }
        ...
    }