trucks-transform-copy

Copy files into the output directory

Usage no npm install needed!

<script type="module">
  import trucksTransformCopy from 'https://cdn.skypack.dev/trucks-transform-copy';
</script>

README

Copy Transform

Copy files into the output directory

Install

npm i trucks-transform-copy --save-dev


Usage

Use the copy key to configure this transform:

const trucks = require('trucks');

trucks(
  {
    files: ['components.html'],
    transforms: ['copy'],
    copy: {
      files: {
        'src/index.html': 'index.html'
      }
    }
  }, (err, res) => {
    if(err) {
      throw err; 
    }
    console.log(res);
  }
);

API

copy

public copy(state, conf)

Copy input files to the output directory.

Files are defined using an input mapping:

{
  copy: {
    files: {
      'src/index.html': 'index.html'
    }
  }
}

Input files are the keys and are resolved relative to the base option. The values are output paths relative to the compiler output directory.

Returns map of visitor functions.

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

Options

  • files Object map of files to copy.
  • base String base path for relative input files.

License

MIT


Created by mkdoc on August 2, 2016