Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kettek/esbuild-plugin-globcopy
esbuild plugin to copy files based on glob patterns
https://github.com/kettek/esbuild-plugin-globcopy
Last synced: 19 days ago
JSON representation
esbuild plugin to copy files based on glob patterns
- Host: GitHub
- URL: https://github.com/kettek/esbuild-plugin-globcopy
- Owner: kettek
- License: mpl-2.0
- Created: 2021-11-05T02:20:52.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-05T03:22:03.000Z (about 3 years ago)
- Last Synced: 2024-12-07T21:59:53.617Z (26 days ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esbuild-plugin-globcopy
An esbuild plugin that adds support for copying files from a source directory to a destination directory using [glob](https://en.wikipedia.org/wiki/Glob_(programming)).Its primary use case is to copy files from a static directory to a distribution directory on build.
## Installation
```bash
npm i -D esbuild-plugin-globcopy
```## Usage
As with the current esbuild plugin API, this plugin requires a custom build script for usage.```js
import esbuild from 'esbuild'
import globCopy from 'esbuild-plugin-globcopy'esbuild.build({
entryPoints: ['src/index.js'],
bundle: true,
outdir: 'dist',
// ...
plugins: [
// ...
globCopy({
// srcdir: 'static',
// targets: ['**.png'],
})
]
})
```## Options
When calling the module, you can pass in an object that contains various options.### srcdir
This input directory to copy files from. Defaults to `./`.### targets
Targets can be an array of strings or a single string that provides glob pattern(s). These are resolved relative to `srcdir`.### outdir
The output directory to copy files to. Defaults to esbuild's `outdir` if unspecified.