# text-transform-loader

> Webpack loader to prepend, append, or otherwise modify the text content of a module

Latest version **2.0.0** (published 2017-05-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install text-transform-loader
pnpm add text-transform-loader
yarn add text-transform-loader
bun add text-transform-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 | 2.0.0 |
| Published | 2017-05-06 |
| First published | 2016-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Keith McKnight |
| Maintainers | kmck |
| Keywords | webpack, loader |

## Links

- npm: https://www.npmjs.com/package/text-transform-loader
- Repository: http://www.github.com/kmck/webpack-text-transform-loader
- npm.io page: https://npm.io/package/text-transform-loader

## Dependencies (1)

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

## 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

- 2.0.0 (latest) — 2017-05-06
- 2.0.0-beta (beta) — 2017-05-05
- 1.1.1 — 2016-04-12
- 1.1.0 — 2016-04-11
- 1.0.2 — 2016-04-09
- 1.0.1 — 2016-04-06
- 1.0.0 — 2016-04-05

## README

# Text Transform Loader

[![Build Status](https://travis-ci.org/kmck/webpack-text-transform-loader.svg?branch=master)](https://travis-ci.org/kmck/webpack-text-transform-loader)

Webpack loader to prepend, append, or otherwise modify the text content of a module

You can use this for things like injecting headers or footers into your modules BEFORE any other
loaders do their processing. For example, say you want to prepend all of your `.scss` files with
the same `@import` function. You can do that!

This version supports [webpack 2.x](https://webpack.js.org/)! If you try it and run into problems, check out the [webpack 1.x](https://github.com/kmck/webpack-text-transform-loader/tree/v1.1.1) release instead.

### Installation

Via yarn:

```bash
yarn add --dev text-transform-loader
```

Via npm:

```bash
npm install --save-dev text-transform-loader
```

### Configuration

Here are the things you can configure:

* `prependText`: adds text to the top of the module
* `appendText`: adds text to the bottom of the module
* `transformText`: transforms the module by running the `content` and loader `options`
 through a custom function that returns the new content

### Usage

Specify the loader and options in your webpack configuration:

```js
{
  // ...
  module: {
    rules: [
      test: /\.s?css$/,
      use: {
        loader: 'text-transform-loader',
        options: {
          prependText: '@import \'your/stuff\';\n\n',
        }
      }
    ]
  },
  // ...
}
```

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