Gathering detailed insights and metrics for @col0ring/vite-plugin-copy
Gathering detailed insights and metrics for @col0ring/vite-plugin-copy
Gathering detailed insights and metrics for @col0ring/vite-plugin-copy
Gathering detailed insights and metrics for @col0ring/vite-plugin-copy
a vite plugin for copying dirs or files after building
npm install @col0ring/vite-plugin-copy
Typescript
Module System
Node Version
NPM Version
64.6
Supply Chain
93.1
Quality
73.6
Maintenance
100
Vulnerability
98.6
License
TypeScript (89.84%)
HTML (10.16%)
Total Downloads
16,701
Last Day
35
Last Week
235
Last Month
850
Last Year
9,470
2 Stars
5 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Oct 11, 2022
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
@col0ring/vite-plugin-copy@1.0.2
Unpacked Size
9.34 kB
Size
2.25 kB
File Count
5
NPM Version
6.14.16
Node Version
12.22.10
Cumulative downloads
Total Downloads
Last Day
0%
35
Compared to previous day
Last Week
11.9%
235
Compared to previous week
Last Month
-20.4%
850
Compared to previous month
Last Year
336%
9,470
Compared to previous year
A vite plugin for copying dirs or files after building.
1npm install @col0ring/vite-plugin-copy -D 2# or 3yarn add @col0ring/vite-plugin-copy -D
1import { defineConfig } from 'vite' 2import path from 'path' 3import viteCopyPlugin from '@col0ring/vite-plugin-copy' 4 5function resolve(relativePath: string) { 6 return path.resolve(__dirname, relativePath) 7} 8 9export default defineConfig({ 10 plugins: [ 11 // ... 12 viteCopyPlugin([ 13 { 14 src: resolve('./dist/index.html'), 15 target: resolve('./dist/index2.html') 16 } 17 ]) 18 ] 19})
The src
and target
options can accept arrays:
1import { defineConfig } from 'vite' 2import path from 'path' 3import viteCopyPlugin from '@col0ring/vite-plugin-copy' 4 5function resolve(relativePath: string) { 6 return path.resolve(__dirname, relativePath) 7} 8 9export default defineConfig({ 10 plugins: [ 11 // ... 12 viteCopyPlugin([ 13 { 14 src: resolve('./dist/index.html'), 15 target: [resolve('./dist/index2.html'), resolve('./dist/index3.html')] 16 } 17 ]) 18 ] 19})
1import { defineConfig } from 'vite' 2import path from 'path' 3import viteCopyPlugin from '@col0ring/vite-plugin-copy' 4 5function resolve(relativePath: string) { 6 return path.resolve(__dirname, relativePath) 7} 8 9export default defineConfig({ 10 plugins: [ 11 // ... 12 viteCopyPlugin([ 13 { 14 src: [resolve('./dist/index.html'), resolve('./dist/assets')], 15 target: [resolve('./dist/dist2'), resolve('./dist/dist3')] 16 } 17 ]) 18 ] 19})
The disk path supports glob
:
1import { defineConfig } from 'vite' 2import path from 'path' 3import viteCopyPlugin from '@col0ring/vite-plugin-copy' 4 5function resolve(relativePath: string) { 6 return path.resolve(__dirname, relativePath) 7} 8 9export default defineConfig({ 10 plugins: [ 11 // ... 12 viteCopyPlugin([ 13 { 14 // move all files in the src directory to the target directory 15 src: resolve('./dist/assets/**/*'), 16 target: resolve('./dist/assets2') 17 } 18 ]) 19 ] 20})
Usually, the plugin will automatically recognize whether the copy is a directory or a file, but you can still specify it manually:
1import { defineConfig } from 'vite' 2import path from 'path' 3import viteCopyPlugin from '@col0ring/vite-plugin-copy' 4 5function resolve(relativePath: string) { 6 return path.resolve(__dirname, relativePath) 7} 8 9export default defineConfig({ 10 plugins: [ 11 // ... 12 viteCopyPlugin([ 13 { 14 // this is a file 15 src: resolve('./dist/file'), 16 target: { 17 isDir: false, 18 path: resolve('./dist/file2') 19 } 20 } 21 ]) 22 ] 23})
1function vitePluginCopy(
2 options: CopyOptions[],
3 globOptions?: glob.IOptions
4): Plugin
src
string | string[]
Resource file or directory.
target
string | string[] | TargetObject | TargetObject[]
Target file or directory.
1interface TargetObject { 2 isDir?: boolean 3 path: string 4}
Custom glob configuration.
No vulnerabilities found.
No security vulnerabilities found.