# injection-loader

> Inject static content to file loader for Webpack Edit

Latest version **1.0.1** (published 2018-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install injection-loader
pnpm add injection-loader
yarn add injection-loader
bun add injection-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 | 2018-01-12 |
| First published | 2018-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | minwe |
| Maintainers | minwe |
| Keywords | webpack, webpack-loader, injection |

## Links

- npm: https://www.npmjs.com/package/injection-loader
- Repository: https://github.com/minwe/injection-loader
- Homepage: https://github.com/minwe/injection-loader#readme
- Issues: https://github.com/minwe/injection-loader/issues
- npm.io page: https://npm.io/package/injection-loader

## Dependencies (2)

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

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-01-12

## README

# Injection Loader

A loader for webpack that lets you inject content to file.

## Install

```bash
npm install --save-dev injection-loader raw-loader
```

## Usage

Use the loader either via your webpack config, CLI or inline.

**Note**: Injection loader just INJECTION ([guidelines](https://webpack.js.org/contribute/writing-a-loader/#guidelines)), you can use it with `raw-loader` to require non-js file.

`webpack.config.js`:

```javascript
module.exports = {
  module: {
    rules: [{
      test: /\.md$/,
      use: [
        {
          loader: 'raw-loader',
        },
        {
          loader: 'injection-loader',
          options: {
            // default pattern
            pattern: /__INCLUDE_FILE\('(.+)'\)/,
          },
        }
      ]
    }]
  }
}
```

In your application

```javascript
import md from 'some.md';
```

`some.md`:

```
# Title

## Sub title

- list 1
- list 1

__INCLUDE_FILE('./injection.txt')
```

**Note**: `__INCLUDE_FILE` path (`./injection.txt`) should RELATIVE to `some.md`.

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