vite-plugin-copy-smartly
v0.1.1-alpha
Published
a hacked version of rollup-plugin-copy to support vite
Downloads
14
Readme
vite-plugin-copy-smartly
This is a not-so-smart hack of the rollup-copy-smartly Rollup plugin by TrickyPi. They take all of the credit for this work, I simply changed two hooks to make it work with Vite. This is not battle tested and there may be better ways to achieve this. PRs welcome.
Features
Smartly copy files if they are changed, created or deleted.
Getting Started
npm install --save-dev vite-plugin-copy-smartly
or
yarn add -D vite-plugin-copy-smartly
or
pnpm add -D vite-plugin-copy-smartly
Use
vite.config.js
import copy from "vite-plugin-copy-smartly";
export default {
...
plugins: [
copy({
src: path.resolve(__dirname, "src/public/"),
pattern: /\.(svg|png|jpg|gif|webp|json|lottie)$/,
dest: path.resolve(__dirname, "web/dist/"),
}),
],
};
Options
| option | type | description | | ------- | ------------------- | ------------------------------------------------------------------------------------ | | src | string | Path to dir which will be watching, it could be absolute path or relative path | | pattern | RegExp or RegExp[ ] | Filter specific files | | dest | string or string[ ] | Paths to dir which are output directorys, it could be absolute path or relative path |