trucks-transform-tree

1.0.2 • Public • Published

Tree Transform

Humanize the component tree

Converts the component tree to another tree suitable for passing to archy.

Install

npm i trucks-transform-tree --save-dev

For the command line interface see trucks-cli.



Usage

Use the tree key to configure this transform:

const trucks = require('trucks');

trucks(
  {
    files: ['components.html'],
    transforms: ['tree'],
    conf: {
      transforms: {
        tree: {
          label: (tag, id) => {
            return tag + '#' + id; 
          }
        }
      }
    }
  }, (err, state) => {
    if(err) {
      throw err; 
    }
    console.log(state.result.tree.toString());
  }
);

License

MIT


Created by mkdoc on July 18, 2016

Readme

Keywords

none

Package Sidebar

Install

npm i trucks-transform-tree

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • muji
  • tmpfs