Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-copy

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-copy

Copy files and folders using Rollup

  • 3.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
490K
decreased by-6.2%
Maintainers
1
Weekly downloads
 
Created

What is rollup-plugin-copy?

The rollup-plugin-copy package is a Rollup plugin that allows you to copy files and folders as part of your build process. This can be useful for tasks such as copying static assets, configuration files, or other resources that need to be included in your final build output.

What are rollup-plugin-copy's main functionalities?

Copying Files

This feature allows you to copy individual files or patterns of files from a source directory to a destination directory. In this example, all files in the 'src/assets' directory are copied to the 'dist/assets' directory.

const copy = require('rollup-plugin-copy');

module.exports = {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    copy({
      targets: [
        { src: 'src/assets/*', dest: 'dist/assets' }
      ]
    })
  ]
};

Copying Folders

This feature allows you to copy entire folders from a source directory to a destination directory. In this example, the 'src/config' folder is copied to the 'dist/config' folder.

const copy = require('rollup-plugin-copy');

module.exports = {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    copy({
      targets: [
        { src: 'src/config', dest: 'dist/config' }
      ]
    })
  ]
};

Transforming Files

This feature allows you to transform the contents of files as they are copied. In this example, the 'src/config.json' file is copied to 'dist/config.json' with all instances of 'foo' replaced with 'bar'.

const copy = require('rollup-plugin-copy');

module.exports = {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    copy({
      targets: [
        { src: 'src/config.json', dest: 'dist/config.json', transform: (contents) => contents.toString().replace(/foo/g, 'bar') }
      ]
    })
  ]
};

Other packages similar to rollup-plugin-copy

Keywords

FAQs

Package last updated on 02 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc