# replace-lz

> --javascript const fs = require("fs"); //封装class方法 class Replace { constructor(opt) { //合并参数 Object.assign(this, opt); //读取到这些文件里面的内容 const htmlCon = fs.readFileSync(this.htmlSrc, "utf-8"); const csslCo

Latest version **2.0.0** (published 2020-11-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install replace-lz
pnpm add replace-lz
yarn add replace-lz
bun add replace-lz
```

## 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 | 2.0.0 |
| Published | 2020-11-18 |
| First published | 2020-11-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lzauiaiwwy |

## Links

- npm: https://www.npmjs.com/package/replace-lz
- npm.io page: https://npm.io/package/replace-lz

## Recent versions

- 2.0.0 (latest) — 2020-11-18
- 1.0.0 — 2020-11-18

## README

#这是一个替换的包
```javascript
const fs = require("fs");
//封装class方法
class Replace {
    constructor(opt) {
        //合并参数
        Object.assign(this, opt);
        //读取到这些文件里面的内容
        const htmlCon = fs.readFileSync(this.htmlSrc, "utf-8");
        const csslCon = fs.readFileSync(this.cssSrc, "utf-8");
        const jslCon = fs.readFileSync(this.jsSrc, "utf-8");
        //为新文件的内容进行复制  也就是替换的过程
        const str = htmlCon.replace("//css替换项", `<style>${csslCon}</style>`).replace("//js替换项", `<script>${jslCon}</script>`);
        //把替换后的内容写入到html文件中
        fs.writeFileSync(this.htmlSrc, str);
    }
}
new Replace({
    htmlSrc: "src/index.html",
    cssSrc: "src/index.css",
    jsSrc: "src/index.js"
})
```

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