# fis3-deploy-replace

> fis3-deploy-replace

Latest version **1.0.2** (published 2015-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install fis3-deploy-replace
pnpm add fis3-deploy-replace
yarn add fis3-deploy-replace
bun add fis3-deploy-replace
```

## 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.2 |
| Published | 2015-08-31 |
| First published | 2015-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | fansekey@gmail.com |
| Maintainers | 2betop, fansekey, fis-dev |
| Keywords | fis3 |

## Links

- npm: https://www.npmjs.com/package/fis3-deploy-replace
- Repository: https://github.com/fex-team/fis3-deploy-replace
- Issues: https://github.com/fex-team/fis3-deploy-replace/issues
- npm.io page: https://npm.io/package/fis3-deploy-replace

## Recent versions

- 1.0.2 (latest) — 2015-08-31
- 1.0.1 — 2015-08-12
- 1.0.0 — 2015-05-28

## README

# fis3-deploy-replace
fis3-deploy-replace


## INSTALL

```bash
npm install [-g] fis3-deploy-replace
```

## USE

```js
fis.match('**', {
    deploy: [
        fis.plugin('replace', {
            from: 'from/string',
            to: 'to/string'
        }),
        fis.plugin('local-deliver') //must add a deliver, such as http-push, local-deliver
    ]
});
```


## EXAMPLE

多字符串替换

```js
fis.match('**', {
    deploy: [
        fis.plugin('replace', {
            from: /(img|cdn)\.baidu\.com/,
            to: function ($0, $1) {
                switch ($1) {
                    case 'img':
                        return '127.0.0.1:8080';
                    case 'cdn':
                        return '127.0.0.1:8081';
                }
                return $0;
            }
        }),
        fis.plugin('local-deliver')
    ]
});
```

或者

```js
function replacer(opt) {
    if (!Array.isArray(opt)) {
        opt = [opt];
    }
    var r = [];
    opt.forEach(function (raw) {
        r.push(fis.plugin('replace', raw));
    });
    return r;
};

fis.match('*', {
    deploy: replacer([
        {
            from: 'a',
            to: 'b',
        },
        {
            from: 'a0',
            to: 'b0'
        }
    ]).concat(fis.plugin('local-deliver'));
});
```

机智的你可能已经发现了点什么。我们配置了多个功能单一的 `fis.plugin('replace')`。

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