11# rollup-plugin-copy-merge
22
3+ ![ GitHub] ( https://img.shields.io/github/license/syJSdev/rollup-plugin-copy-merge )
4+ [ ![ npm] ( https://img.shields.io/npm/v/rollup-plugin-copy-merge )] ( https://www.npmjs.com/package/rollup-plugin-copy-merge )
35[ ![ build] ( https://travis-ci.com/syJSdev/rollup-plugin-copy-merge.svg?branch=main )] ( https://travis-ci.com/github/syJSdev/rollup-plugin-copy-merge )
46[ ![ codecov] ( https://codecov.io/gh/syJSdev/rollup-plugin-copy-merge/branch/main/graph/badge.svg?token=RMODCAC64I )] ( https://codecov.io/gh/syJSdev/rollup-plugin-copy-merge )
57
@@ -11,10 +13,10 @@ Thanks [#vladshcherbin](https://github.com/vladshcherbin)
1113
1214``` bash
1315# yarn
14- yarn add git+https://github.com/syJSdev/ rollup-plugin-copy-merge.git -D
16+ yarn add rollup-plugin-copy-merge --dev
1517
1618# npm
17- npm i git+https://github.com/syJSdev/ rollup-plugin-copy-merge.git -D
19+ npm i rollup-plugin-copy-merge --save-dev
1820```
1921
2022## Usage
@@ -80,39 +82,39 @@ copy({
8082``` js
8183copy ({
8284 targets: [{ src: ' src/index.html' , dest: ' dist/public' }]
83- })
85+ });
8486```
8587
8688##### Folder
8789
8890``` js
8991copy ({
9092 targets: [{ src: ' assets/images' , dest: ' dist/public' }]
91- })
93+ });
9294```
9395
9496##### Glob
9597
9698``` js
9799copy ({
98100 targets: [{ src: ' assets/*' , dest: ' dist/public' }]
99- })
101+ });
100102```
101103
102104##### Glob: multiple items
103105
104106``` js
105107copy ({
106108 targets: [{ src: [' src/index.html' , ' src/styles.css' , ' assets/images' ], dest: ' dist/public' }]
107- })
109+ });
108110```
109111
110112##### Glob: negated patterns
111113
112114``` js
113115copy ({
114116 targets: [{ src: [' assets/images/**/*' , ' !**/*.gif' ], dest: ' dist/public/images' }]
115- })
117+ });
116118```
117119
118120##### Multiple targets
@@ -123,23 +125,23 @@ copy({
123125 { src: ' src/index.html' , dest: ' dist/public' },
124126 { src: ' assets/images/**/*' , dest: ' dist/public/images' }
125127 ]
126- })
128+ });
127129```
128130
129131##### Multiple destinations
130132
131133``` js
132134copy ({
133135 targets: [{ src: ' src/index.html' , dest: [' dist/public' , ' build/public' ] }]
134- })
136+ });
135137```
136138
137139##### Rename with a string
138140
139141``` js
140142copy ({
141143 targets: [{ src: ' src/app.html' , dest: ' dist/public' , rename: ' index.html' }]
142- })
144+ });
143145```
144146
145147##### Rename with a function
@@ -153,7 +155,7 @@ copy({
153155 rename : (name , extension ) => ` ${ name} -v1.${ extension} `
154156 }
155157 ]
156- })
158+ });
157159```
158160
159161##### Transform file contents
@@ -167,7 +169,7 @@ copy({
167169 transform : (contents ) => contents .toString ().replace (' __SCRIPT__' , ' app.js' )
168170 }
169171 ]
170- })
172+ });
171173```
172174
173175#### verbose
@@ -180,7 +182,7 @@ Output copied items to console.
180182copy ({
181183 targets: [{ src: ' assets/*' , dest: ' dist/public' }],
182184 verbose: true
183- })
185+ });
184186```
185187
186188#### hook
@@ -193,7 +195,7 @@ Type: `string` | Default: `buildEnd`
193195copy ({
194196 targets: [{ src: ' assets/*' , dest: ' dist/public' }],
195197 hook: ' writeBundle'
196- })
198+ });
197199```
198200
199201#### copyOnce
@@ -206,7 +208,7 @@ Copy items once. Useful in watch mode.
206208copy ({
207209 targets: [{ src: ' assets/*' , dest: ' dist/public' }],
208210 copyOnce: true
209- })
211+ });
210212```
211213
212214#### flatten
@@ -219,7 +221,7 @@ Remove the directory structure of copied files.
219221copy ({
220222 targets: [{ src: ' assets/**/*' , dest: ' dist/public' }],
221223 flatten: false
222- })
224+ });
223225```
224226
225227All other options are passed to packages, used inside:
0 commit comments