0.1.1 • Published 11 years ago

broccoli-writer v0.1.1

Weekly downloads
35,622
License
MIT
Repository
github
Last release
11 years ago

broccoli-writer

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.

Installation

npm --save broccoli-writer

Usage

Write your plugin like so:

var Writer = require('broccoli-writer');

module.exports = MyCompiler;
MyCompiler.prototype = Object.create(Writer.prototype);
MyCompiler.prototype.constructor = MyCompiler;
function MyCompiler (arg1, arg2, ...) {
  if (!(this instanceof MyCompiler)) return new MyCompiler(arg1, arg2, ...);
  ...
};

MyCompiler.prototype.write = function (readTree, destDir) {
  ...
};

Inside MyCompiler.prototype.write, 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.

In the MyCompiler constructor, you don't need to call the Writer base class constructor.

Your plugin can be used in Brocfile.js like so:

var compileSomething = require('broccoli-my-compiler');

var outputTree = compileSomething(arg1, arg2, ...)
broccoli-auto-generated@infinitebrahmanuniverse/nolb-broc@everything-registry/sub-chunk-1265tacoli-broccoli-fingerprintremove-bompriuspc-ember-freestylenashtech-angular-cli@boundless-inc/mobiledoc-dom-renderercandycane-clibroccoli-static-compilerbroccoli-suitcssbroccoli-svg-concatenatorbroccoli-system-builderbroccoli-sassdocbroccoli-selectbroccoli-selectfnbroccoli-serviceworkerbroccoli-shallow-treebroccoli-spelunkbroccoli-spritesmithbroccoli-themerbroccoli-manifestbroccoli-merge-jsonbroccoli-mincerbroccoli-neuterbroccoli-ng-templatesbroccoli-revbroccoli-riotbroccoli-rsassbroccoli-sass-image-compilerbroccoli-ractivebroccoli-object-writerbroccoli-preprocessbroccoli-preprocess-treebroccoli-replicatebroccoli-angular-templatesbroccoli-curlbroccoli-dereferencebroccoli-doccobroccoli-appcachebroccoli-billy-builderbroccoli-bowerbroccoli-browserifybroccoli-bundle-assetsbroccoli-change-extensionbroccoli-combine-mqbroccoli-compassbroccoli-compile-modulesbroccoli-config-writerbroccoli-criticalbroccoli-cssmyiconsbroccoli-bembroccoli-bemlbroccoli-concat-cabbagebroccoli-concat-filenamesbroccoli-concat-source-mapbroccoli-ember-i18n-precompilebroccoli-empty-dirsbroccoli-es-dependency-graphbroccoli-es6-concatbroccoli-es6-concatenatorbroccoli-embed-scriptbroccoli-ember-auto-registerbroccoli-html2jsbroccoli-i18n-compilerbroccoli-i18n-precompilebroccoli-jetbroccoli-js-module-formatsbroccoli-json-concatbroccoli-kssbroccoli-lambdabroccoli-file-moverbroccoli-file-removerbroccoli-fileindexbroccoli-fingerprintbroccoli-flattenbroccoli-file-contents-to-jsonbroccoli-es6-module-facadebroccoli-es6-module-transpilerbroccoli-extract-commentsbroccoli-tree-to-jsonbroccoli-typescriptbroccoli-vulcanize-html-importsbroccoli-wintersmithbroccoli-wiredependenciesbroccolifybricks-cliember-cli-app-version-fileember-cli-toranbcordova-plugin-amplify-paycordova-plugin-amplify-paymentember-code-snippetember-component-css-withbp
0.1.1

11 years ago

0.1.0

11 years ago