3.0.0 • Published 2 years ago

laravel-mix-copy-watched v3.0.0

Weekly downloads
1,777
License
MIT
Repository
github
Last release
2 years ago

Laravel Mix Copy Watched npm version GitHub license

This extension provides a copy method that can watch for not only changes but also additions and deletions.

Installation

With laravel-mix@>=6

$ npm install --save-dev laravel-mix-copy-watched

With laravel-mix@<6

$ npm install --save-dev laravel-mix-copy-watched@2

Usage

let mix = require('laravel-mix');

require('laravel-mix-copy-watched');

mix
  .js('resources/js/app.js', 'public/js')
  .sass('resources/sass/app.scss', 'public/css')
  .copyWatched('resources/images/app.png', 'public/images');

API

copyWatched(from, to, options)

This method has the same usage as the copy and copyDirectory methods.

from

Type: string | string[]

Paths or glob patterns to files and directories to be copied.

mix.copyWatched('from.png', 'to');
mix.copyWatched('from/**/*.txt', 'to');
mix.copyWatched('from/**/*.{jpg,jpeg,png,gif}', 'to');
mix.copyWatched(['from1.jpg', 'from2.webp'], 'to');

to

Type: string

Destination path for copied files and directories.

options

Type: object

Contains the following properties.

base

Type: string
Default: ''

When a path to a directory is set, the directory will be copied with the hierarchical structure kept.

// resources/images/foo.png -> public/foo.png
mix.copyWatched(
  'resources/**/*',
  'public'
);

// resources/images/foo.png -> public/images/foo.png
mix.copyWatched(
  'resources/**/*',
  'public',
  { base: 'resources' }
);
dot

Type: boolean
Default: false

If set to true, files and directories whose names start with a dot will be copied.

// resources/.foorc -> No output
mix.copyWatched(
  'resources',
  'public',
);

// resources/.foorc -> public/.foorc
mix.copyWatched(
  'resources',
  'public',
  { dot: true }
);

copyDirectoryWatched(from, to, options)

This method is an alias for the copyWatched method.

3.0.0-alpha.1

2 years ago

3.0.0

2 years ago

3.0.0-alpha.0

2 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago