{"id":13774874,"url":"https://github.com/vladshcherbin/rollup-plugin-copy","last_synced_at":"2026-05-23T00:31:25.783Z","repository":{"id":37932831,"uuid":"89777333","full_name":"vladshcherbin/rollup-plugin-copy","owner":"vladshcherbin","description":"Copy files and folders using Rollup","archived":false,"fork":false,"pushed_at":"2023-11-27T15:34:14.000Z","size":352,"stargazers_count":272,"open_issues_count":32,"forks_count":55,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-27T22:01:48.678Z","etag":null,"topics":["asset","copy","cp","file","folder","glob","rollup","rollup-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vladshcherbin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-29T10:03:32.000Z","updated_at":"2025-03-20T06:06:19.000Z","dependencies_parsed_at":"2024-06-18T12:37:36.147Z","dependency_job_id":null,"html_url":"https://github.com/vladshcherbin/rollup-plugin-copy","commit_stats":{"total_commits":118,"total_committers":11,"mean_commits":"10.727272727272727","dds":0.2033898305084746,"last_synced_commit":"c874b668662802d0d7ce77f9eb7408c30e2977bf"},"previous_names":["meuter/rollup-plugin-copy"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladshcherbin%2Frollup-plugin-copy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladshcherbin%2Frollup-plugin-copy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladshcherbin%2Frollup-plugin-copy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladshcherbin%2Frollup-plugin-copy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vladshcherbin","download_url":"https://codeload.github.com/vladshcherbin/rollup-plugin-copy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252414109,"owners_count":21744042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asset","copy","cp","file","folder","glob","rollup","rollup-plugin"],"created_at":"2024-08-03T17:01:31.166Z","updated_at":"2026-05-23T00:31:25.776Z","avatar_url":"https://github.com/vladshcherbin.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Output"],"readme":"# rollup-plugin-copy\n\nCopy files and folders, with glob support.\n\n## Installation\n\n```bash\n# pnpm\npnpm add rollup-plugin-copy -D\n\n# yarn\nyarn add rollup-plugin-copy -D\n\n# npm\nnpm install rollup-plugin-copy -D\n```\n\n## Usage\n\n```js\n// rollup.config.js\nimport copy from 'rollup-plugin-copy'\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/app.js',\n    format: 'cjs'\n  },\n  plugins: [\n    copy({\n      targets: [\n        { src: 'src/index.html', dest: 'dist/public' },\n        { src: ['assets/fonts/arial.woff', 'assets/fonts/arial.woff2'], dest: 'dist/public/fonts' },\n        { src: 'assets/images/**/*', dest: 'dist/public/images' }\n      ]\n    })\n  ]\n}\n```\n\n### Configuration\n\nThere are some useful options:\n\n#### targets\n\nType: `Array` | Default: `[]`\n\nArray of targets to copy. A target is an object with properties:\n\n- **src** (`string` `Array`): Path or glob of what to copy\n- **dest** (`string` `Array`): One or more destinations where to copy\n- **rename** (`string` `Function`): Change destination file or folder name\n- **transform** (`Function`): Modify file contents\n\nEach object should have **src** and **dest** properties, **rename** and **transform** are optional. [globby](https://github.com/sindresorhus/globby) is used inside, check it for [glob pattern](https://github.com/sindresorhus/globby#globbing-patterns) examples.\n\n##### File\n\n```js\ncopy({\n  targets: [{ src: 'src/index.html', dest: 'dist/public' }]\n})\n```\n\n##### Folder\n\n```js\ncopy({\n  targets: [{ src: 'assets/images', dest: 'dist/public' }]\n})\n```\n\n##### Glob\n\n```js\ncopy({\n  targets: [{ src: 'assets/*', dest: 'dist/public' }]\n})\n```\n\n##### Glob: multiple items\n\n```js\ncopy({\n  targets: [{ src: ['src/index.html', 'src/styles.css', 'assets/images'], dest: 'dist/public' }]\n})\n```\n\n##### Glob: negated patterns\n\n```js\ncopy({\n  targets: [{ src: ['assets/images/**/*', '!**/*.gif'], dest: 'dist/public/images' }]\n})\n```\n\n##### Multiple targets\n\n```js\ncopy({\n  targets: [\n    { src: 'src/index.html', dest: 'dist/public' },\n    { src: 'assets/images/**/*', dest: 'dist/public/images' }\n  ]\n})\n```\n\n##### Multiple destinations\n\n```js\ncopy({\n  targets: [{ src: 'src/index.html', dest: ['dist/public', 'build/public'] }]\n})\n```\n\n##### Rename with a string\n\n```js\ncopy({\n  targets: [{ src: 'src/app.html', dest: 'dist/public', rename: 'index.html' }]\n})\n```\n\n##### Rename with a function\n\n```js\ncopy({\n  targets: [{\n    src: 'assets/docs/*',\n    dest: 'dist/public/docs',\n    rename: (name, extension, fullPath) =\u003e `${name}-v1.${extension}`\n  }]\n})\n```\n\n##### Transform file contents\n\n```js\ncopy({\n  targets: [{\n    src: 'src/index.html',\n    dest: 'dist/public',\n    transform: (contents, filename) =\u003e contents.toString().replace('__SCRIPT__', 'app.js')\n  }]\n})\n```\n\n#### verbose\n\nType: `boolean` | Default: `false`\n\nOutput copied items to console.\n\n```js\ncopy({\n  targets: [{ src: 'assets/*', dest: 'dist/public' }],\n  verbose: true\n})\n```\n\n#### hook\n\nType: `string` | Default: `buildEnd`\n\n[Rollup hook](https://rollupjs.org/guide/en/#hooks) the plugin should use. By default, plugin runs when rollup has finished bundling, before bundle is written to disk.\n\n```js\ncopy({\n  targets: [{ src: 'assets/*', dest: 'dist/public' }],\n  hook: 'writeBundle'\n})\n```\n\n#### copyOnce\n\nType: `boolean` | Default: `false`\n\nCopy items once. Useful in watch mode.\n\n```js\ncopy({\n  targets: [{ src: 'assets/*', dest: 'dist/public' }],\n  copyOnce: true\n})\n\n```\n#### copySync\n\nType: `boolean` | Default: `false`\n\nCopy items synchronous.\n\n```js\ncopy({\n  targets: [{ src: 'assets/*', dest: 'dist/public' }],\n  copySync: true\n})\n```\n\n#### flatten\n\nType: `boolean` | Default: `true`\n\nRemove the directory structure of copied files.\n\n```js\ncopy({\n  targets: [{ src: 'assets/**/*', dest: 'dist/public' }],\n  flatten: false\n})\n```\n\nAll other options are passed to packages, used inside:\n  - [globby](https://github.com/sindresorhus/globby)\n  - [fs-extra copy function](https://github.com/jprichardson/node-fs-extra/blob/7.0.0/docs/copy.md)\n\n## Original Author\n\n[Cédric Meuter](https://github.com/meuter)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladshcherbin%2Frollup-plugin-copy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladshcherbin%2Frollup-plugin-copy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladshcherbin%2Frollup-plugin-copy/lists"}