elixir-copy - Elixir recipe to copy files from on directory to another. Enhanced with gulp-copy to mirror directories.
Prerequirement
You have to install Laravel's Elixir(Version 3.0 or higher) and its dependencies first.
Installation
Install with Node.js
npm install elixir-copy
Usage
Add it to your Elixir-enhanced Gulpfile, like so:
var elixir = require('laravel-elixir');
// import the dependency
var copyto = require('elixir-copy');
elixir(function(mix) {
mix.copyto('file.ext', 'path/to/folder');
});
This will copy the file (located by default in your resources/assets/
) folder to the destination folder.
You can also provide an array of input files to copy.
mix.copyto(['file.ext', 'file2.ext'], 'path/to/folder');
By default, it will look for files in your resources/assets/
folder. All files provided in the input array need be relative to this folder. However you can override the default source folder as well.
mix.copyto(['file.ext', 'file2.ext'], 'path/to/folder', 'some/source/folder');
The source folder is relative to your Laravel root folder.
Want to mirror the folder structure? In the options, provide a flag of mirror
and the recipe will duplicate the entire folder structure from the source files to the destination folder:
mix.copyto(['file.ext', 'sub/folder/file2.ext'], 'path/to/folder', 'some/source/folder', { mirror: true });
This will create the complete path of path/to/folder/some/source/folder/file.ext and path/to/folder/some/source/folder/sub/folder/file2.ext.