# name-replace-loader

> A loader for webpack that replaces names using strings or regular expressions

Latest version **1.0.1** (published 2016-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install name-replace-loader
pnpm add name-replace-loader
yarn add name-replace-loader
bun add name-replace-loader
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-09-27 |
| First published | 2016-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Noah Robison-Cox |
| Maintainers | noahrc |
| Keywords | webpack, loader, webpack-loader, replace, name, regex |

## Links

- npm: https://www.npmjs.com/package/name-replace-loader
- Repository: https://github.com/noahrc/name-replace-loader
- Issues: https://github.com/noahrc/name-replace-loader/issues
- npm.io page: https://npm.io/package/name-replace-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ^0.2.16

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-09-27

## README

# Name replacement loader for [webpack](http://webpack.github.io)

This loader replaces patterns in the name of modules using strings or regular expressions.

# Example

Given a source file named `example.foo.yml`

With this loader in your webpack config:

```
loaders: [
  {
    test: /\.yml$/,
    loader: 'file?name=[name].[ext]!name-replace?find=foo&replace=baz'
  }
]
```

A file would be output with the name `example.baz.yml`.

## Empty strings

You can replace a match with an empty string like so:

```
    loader: 'file?name=[name].[ext]!name-replace?find=foo&replace='
```

## Regex example

To use a Regular Expression for the find pattern, pass a flags query parameter. It can be an empty string if you just want the default flag.

```
loader: 'file?name=[name].[ext]!name-replace?find=\.[s|S]chema&replace=.bar&flags='
```

## Contributing

Please follow the coding style settings in the .editorconfig and .jscsrc files. When committing, please follow our commit conventions by using `npm run commit` instead of `git commit`.

## Licence:

[MIT](http://en.wikipedia.org/wiki/MIT_License)

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