All Projects → vladshcherbin → Rollup Plugin Copy

vladshcherbin / Rollup Plugin Copy

Copy files and folders using Rollup

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Rollup Plugin Copy

Cpx
A cli tool to watch and copy file globs.
Stars: ✭ 394 (+207.81%)
Mutual labels:  copy, glob, file
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+1992.97%)
Mutual labels:  copy, glob, file
tartifacts
📦 Create artifacts for your assemblies
Stars: ✭ 20 (-84.37%)
Mutual labels:  copy, glob
rollup-plugin-glob-import
A rollup plugin to use glob-star.
Stars: ✭ 18 (-85.94%)
Mutual labels:  rollup, glob
Xcv
✂️ Cut, Copy and Paste files with Bash
Stars: ✭ 144 (+12.5%)
Mutual labels:  copy, glob
replace-in-files
Replace text in one or more files or globs.
Stars: ✭ 21 (-83.59%)
Mutual labels:  glob, file
fs-utils
Generalized file and path utils for Node.js projects.
Stars: ✭ 33 (-74.22%)
Mutual labels:  copy, file
Replace In File
A simple utility to quickly replace contents in one or more files
Stars: ✭ 369 (+188.28%)
Mutual labels:  glob, file
Fcfilemanager
iOS File Manager on top of NSFileManager for simplifying files management. 📂
Stars: ✭ 862 (+573.44%)
Mutual labels:  copy, file
React Image File Resizer
Resize Local Images with React 🌄 🌅
Stars: ✭ 108 (-15.62%)
Mutual labels:  file
Actionpacks
Public PowerShell script gallery for ScriptRunner.
Stars: ✭ 118 (-7.81%)
Mutual labels:  file
Angular Seed Express
[DEPRECATED, Please use https://github.com/vyakymenko/angular-express] Extensible, reliable and modular starter project for Angular 7 with statically typed build AoT compilation, Express server and PM2 Daemon.
Stars: ✭ 107 (-16.41%)
Mutual labels:  rollup
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (-10.94%)
Mutual labels:  rollup
Eleventy Starter
ARCHIVED: An Eleventy starting point with Tailwind and Svelte preconfigured.
Stars: ✭ 118 (-7.81%)
Mutual labels:  rollup
Cjstoesm
A tool that can transform CommonJS to ESM
Stars: ✭ 109 (-14.84%)
Mutual labels:  rollup
Jquery Filepond
🔌 A handy FilePond wrapper for jQuery
Stars: ✭ 124 (-3.12%)
Mutual labels:  file
Vue Example
Vue.js Examples
Stars: ✭ 105 (-17.97%)
Mutual labels:  rollup
Redis Tools
my tools working with redis
Stars: ✭ 104 (-18.75%)
Mutual labels:  copy
React Files
A file input (dropzone) management component for React
Stars: ✭ 126 (-1.56%)
Mutual labels:  file
Callapp Lib
🔥call app from h5(H5唤起客户端 )
Stars: ✭ 1,857 (+1350.78%)
Mutual labels:  rollup

rollup-plugin-copy

Build Status Codecov

Copy files and folders, with glob support.

Installation

# yarn
yarn add rollup-plugin-copy -D

# npm
npm install rollup-plugin-copy -D

Usage

// rollup.config.js
import copy from 'rollup-plugin-copy'

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/app.js',
    format: 'cjs'
  },
  plugins: [
    copy({
      targets: [
        { src: 'src/index.html', dest: 'dist/public' },
        { src: ['assets/fonts/arial.woff', 'assets/fonts/arial.woff2'], dest: 'dist/public/fonts' },
        { src: 'assets/images/**/*', dest: 'dist/public/images' }
      ]
    })
  ]
}

Configuration

There are some useful options:

targets

Type: Array | Default: []

Array of targets to copy. A target is an object with properties:

  • src (string Array): Path or glob of what to copy
  • dest (string Array): One or more destinations where to copy
  • rename (string Function): Change destination file or folder name
  • transform (Function): Modify file contents

Each object should have src and dest properties, rename and transform are optional. globby is used inside, check it for glob pattern examples.

File
copy({
  targets: [{ src: 'src/index.html', dest: 'dist/public' }]
})
Folder
copy({
  targets: [{ src: 'assets/images', dest: 'dist/public' }]
})
Glob
copy({
  targets: [{ src: 'assets/*', dest: 'dist/public' }]
})
Glob: multiple items
copy({
  targets: [{ src: ['src/index.html', 'src/styles.css', 'assets/images'], dest: 'dist/public' }]
})
Glob: negated patterns
copy({
  targets: [{ src: ['assets/images/**/*', '!**/*.gif'], dest: 'dist/public/images' }]
})
Multiple targets
copy({
  targets: [
    { src: 'src/index.html', dest: 'dist/public' },
    { src: 'assets/images/**/*', dest: 'dist/public/images' }
  ]
})
Multiple destinations
copy({
  targets: [{ src: 'src/index.html', dest: ['dist/public', 'build/public'] }]
})
Rename with a string
copy({
  targets: [{ src: 'src/app.html', dest: 'dist/public', rename: 'index.html' }]
})
Rename with a function
copy({
  targets: [{
    src: 'assets/docs/*',
    dest: 'dist/public/docs',
    rename: (name, extension, fullPath) => `${name}-v1.${extension}`
  }]
})
Transform file contents
copy({
  targets: [{
    src: 'src/index.html',
    dest: 'dist/public',
    transform: (contents, filename) => contents.toString().replace('__SCRIPT__', 'app.js')
  }]
})

verbose

Type: boolean | Default: false

Output copied items to console.

copy({
  targets: [{ src: 'assets/*', dest: 'dist/public' }],
  verbose: true
})

hook

Type: string | Default: buildEnd

Rollup hook the plugin should use. By default, plugin runs when rollup has finished bundling, before bundle is written to disk.

copy({
  targets: [{ src: 'assets/*', dest: 'dist/public' }],
  hook: 'writeBundle'
})

copyOnce

Type: boolean | Default: false

Copy items once. Useful in watch mode.

copy({
  targets: [{ src: 'assets/*', dest: 'dist/public' }],
  copyOnce: true
})

flatten

Type: boolean | Default: true

Remove the directory structure of copied files.

copy({
  targets: [{ src: 'assets/**/*', dest: 'dist/public' }],
  flatten: false
})

All other options are passed to packages, used inside:

Original Author

Cédric Meuter

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].