# copy-loader

> copy loader module for webpack

Latest version **0.1.3** (published 2015-08-27) · 0 weekly downloads

## Install

```sh
npm install copy-loader
pnpm add copy-loader
yarn add copy-loader
bun add copy-loader
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2015-08-27 |
| First published | 2014-08-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mark Marijnissen |
| Maintainers | markmarijnissen |

## Links

- npm: https://www.npmjs.com/package/copy-loader
- Repository: git@github.com:markmarijnissen/copy-loader
- Homepage: https://github.com/markmarijnissen/copy-loader
- Issues: https://github.com/markmarijnissen/copy-loader/issues
- npm.io page: https://npm.io/package/copy-loader

## Recent versions

- 0.1.3 (latest) — 2015-08-27
- 0.1.2 — 2014-08-04
- 0.1.1 — 2014-08-04
- 0.1.0 — 2014-08-04

## README

# DEPRECATED

Just use `file-loader`: `file?name=[path][name].[ext]&context=./src`. 

Or, to keep a pretty syntax, add this to your `webpack.config.js`:

```javascript
    resolveLoader: { 
        alias: {
            'copy': 'file-loader?name=[path][name].[ext]&context=./src',
        }
    },
```

So you can just do

```javascript
    require("copy!somedir/myfile.html");
```

and `src/somedir/myfile.html` will get copied to `<outputPath>/somedir/myfile.html`.

# copy loader for webpack

## Usage

``` javascript
// in /src/images/index.js

var url = require("copy!./file.png");

// copies file.png to /output/images/file.png
// url = "/images/file.png"
```

copy-loader copies a file from source to your output path without changing directory structure or filename. This is unlike the file-loader, which hashes the file and forgets the directory structure.

The directory structure is copied from the **root directory**, which is determined as follows:

1. From the query-string: e.g. `require("copy?src!./file.png")`
2. From `copyContext` in webpack.config.js
3. From `context` in webpack.config.js (defaults to `process.cwd()`, the current working directory)

**Note:** You don't have to specify the full **path** - the directory name itself is sufficient.

## License

MIT (http://www.opensource.org/licenses/mit-license.php)

---
_Source: https://npm.io/package/copy-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
