0.1.1-alpha • Published 8 months ago

vite-plugin-copy-smartly v0.1.1-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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

optiontypedescription
srcstringPath to dir which will be watching, it could be absolute path or relative path
patternRegExp or RegExp Filter specific files
deststring or string Paths to dir which are output directorys, it could be absolute path or relative path
0.1.1-alpha

8 months ago

0.1.0-alpha

8 months ago