Helper base class for Broccoli plugins that write output files
Base class for Broccoli plugins that write an output tree. Most plugins fall into this category (the exception being plugins that just point at an existing directory on the file system, like broccoli-bower), so they will be implemented either using this base class or using a derived, more specific base class.
This base class's main purpose is to create and clean up the temporary output directory for you.
npm --save broccoli-writer
Write your plugin like so:
var Writer = require'broccoli-writer';moduleexports = MyCompiler;ObjectcreateWriterprototype;MyCompiler;if !this instanceof MyCompiler return arg1 arg2 ;;;
readTree is supplied by
Broccoli -- call
readTree(someInputTree) to read another tree.
destDir is the path to a
newly-created temporary directory created by the
Writer base class. Place
all the output files you wish to generate in this directory.
If you want to do something asynchronous, return a promise that resolves when you are done.
MyCompiler constructor, you don't need to call the
Your plugin can be used in
Brocfile.js like so:
var compileSomething = require'broccoli-my-compiler';var outputTree = compileSomethingarg1 arg2