Skip to content

An esbuild plugin that allows to easily copy files and folders across the application

License

Notifications You must be signed in to change notification settings

whatdoyouseedoc/esbuild-copy-files-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm statistic

NPM Downloads Dependents (via libraries.io) Dependent repos

esbuild-copy-files-plugin

https://www.npmjs.com/package/esbuild-copy-files-plugin

An esbuild plugin that allows to easily copy files and folders across the application

Install:

npm i esbuild-copy-files-plugin

Simple plugin for copy files and folders from one place to another. Need to copy your index.html and images in build folder? This is what you need!

source can be string or string[]

target can be string (copy in one place) or string[] (copy in multiple places)

Example 1 (copy with folder):

esbuild.build({  
  /*
   *  common build stuff
   */
   
   plugins: [
    copy({
      source: ['./src/index.html', './src/images'],
      target: './public',
      copyWithFolder: true  // will copy "images" folder with all files inside
    })
   ]
});

Result:

project/
├── public/
│   ├── images/
|   |   ├── inner-folder/
|   |   |   └── inner-image.jpeg
|   |   ├── image1.jpeg
|   |   └── image2.jpeg
│   └── index.html
|
├── src/
│   ├── images/
|   |   ├── inner-folder/
|   |   |   └── inner-image.jpeg
|   |   ├── image1.jpeg
|   |   └── image2.jpeg
│   └── index.html

Example 2 (unboxing the folder):

esbuild.build({  
  /*
   *  common build stuff
   */
   
   plugins: [
    copy({
      source: ['./src/index.html', './src/images'],
      target: './public',
      copyWithFolder: false  // will copy everything from images/ directly in src/
    })
   ]
});

Result:

project/
├── public/
|   ├── inner-folder/
|   |   └── inner-image.jpeg
|   ├── image1.jpeg
|   └── image2.jpeg
│   └── index.html
|
├── src/
│   ├── images/
|   |   ├── inner-folder/
|   |   |   └── inner-image.jpeg
|   |   ├── image1.jpeg
|   |   └── image2.jpeg
│   └── index.html

About

An esbuild plugin that allows to easily copy files and folders across the application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published