https://github.com/seebigs/bundl-copy
https://github.com/seebigs/bundl-copy
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/seebigs/bundl-copy
- Owner: seebigs
- Created: 2017-02-26T15:53:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-16T18:22:11.000Z (about 8 years ago)
- Last Synced: 2025-10-01T04:55:42.506Z (8 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bundl-copy
*Copy matched src files into another directory*
*Runs with the amazing [Bundl](https://github.com/seebigs/bundl) build tool at the [src stage](https://github.com/seebigs/bundl/wiki/Build-Stages)*
## Install
```
$ npm install --save-dev bundl-copy
```
## Use
```js
var Bundl = require('bundl');
var copy = require('bundl-copy');
var options = {
dest: 'dist/public',
flatten: true
};
new Bundl(targets)
.src(copy(options))
.go();
```
## Setting the destination path (required)
This can be done by simply passing a string into the copy plugin
```js
copy('dist/public')
```
Or, if more options are needed, it can be set as a member of the options object
```js
copy({ dest: 'dist/public' })
```
## Options
### basedir
By default, copied files maintain their original paths relative to `basedir` when copied into the `dest` folder. If basedir is not specified, `process.cwd()` will be used.
```js
{
basedir: 'src/stylesheets'
}
```
### filter
If provided, this Function will be used to filter which files should be copied. Returning `true` allows the current file to be copied. Returning `false` skips the current file.
```js
{
filter: function (extName, fileName, srcPath) {
if (extName === 'css' && fileName.indexOf('_private') === -1) {
return true;
}
}
}
```
### flatten
Setting `flatten` to true will cause all matched files to be copied into the root of `dest` (`basedir` will be ignored).
```js
{
flatten: true
}
```