code: function handleLayout(obj, stats, depth) {
          var layoutName = obj.layout.basename;
          debug('applied layout (#%d) "%s", to file "%s"', depth, layoutName, file.path);
  
          file.currentLayout = obj.layout;
          file.define('layoutStack', stats.history);
          app.handleOnce('onLayout', file);
          delete file.currentLayout;
        }
docs: Handle each layout before it's applied to a file