# template-insert

> Create templates with placeholders and insert variables into the placeholders. Works with every text but was designed for HTML files.

Latest version **1.0.0** (published 2022-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install template-insert
pnpm add template-insert
yarn add template-insert
bun add template-insert
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-05-08 |
| First published | 2022-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Azeo42 |
| Maintainers | azeo42 |
| Keywords | Template, Html |

## Links

- npm: https://www.npmjs.com/package/template-insert
- Repository: https://github.com/Azeo42/template-insert
- Homepage: https://github.com/Azeo42/template-insert#readme
- Issues: https://github.com/Azeo42/template-insert/issues
- npm.io page: https://npm.io/package/template-insert

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-05-08

## README

# template-insert
Create templates with placeholders and insert variables into the placeholders.  Works with every text but was designed for HTML files.

# Install the package:
```npm install template-insert```

# Replace placeholders without a file

```javascript
   import {replaceContent} from "template-insert"
    
   const replacement = replaceContent("Normal text {{replaceme}} Normal text again",
     {
        replaceme: "Replaced Placeholder"
     }
    )
    
    //Result: 'Normal text Replaced Placeholder Normal text again'
```

# Replace placeholders from a file

```javascript
   import {replaceContent} from "template-insert"
   import {readFileSync} from "fs"
   
   const content = readFileSync("./index.html", {encoding: "utf8"})
   const replacement = replaceContent(content,
     {
        replaceme: "Replaced Placeholder",
        replacemetoo: "Another Placeholder"
     }
    )
```

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