1.0.0 • Published 8 years ago

trucks-transform-usage v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Usage Transform

Generate component usage examples

Install

npm i trucks-transform-trim --save-dev

For the command line interface see trucks-cli.

For each component module definition scan the input document for elements matching the component tag name and write them to usage HTML files.



Usage

Use the usage key to configure this transform:

const trucks = require('trucks');

trucks(
  {
    files: ['components.html'],
    transforms: ['usage'],
    usage: {
      main: false,
      files: true
    }
  }, (err, state) => {
    if(err) {
      throw err; 
    }
    console.log(state);
  }
);

API

trim

public trim(state, conf)

Removes leading and trailing whitespace from inline styles and scripts.

When the lines option is given each line is stripped of leading whitespace that matches the pattern regular expression.

Returns map of visitor functions.

  • state Object compiler state.
  • conf Object transform plugin configuration.

Options

  • inline Boolean=true only replace inline elements.
  • lines Boolean=true strip each line.
  • templates Boolean=false also trim template elements.

License

MIT


Created by mkdoc on August 4, 2016