# simple-preprocess

> Preprocess html, js and css based off environment configuration

Latest version **1.0.2** (published 2015-06-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-preprocess
pnpm add simple-preprocess
yarn add simple-preprocess
bun add simple-preprocess
```

Provides the command `simple-preprocess`.

## 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-06-15 |
| First published | 2015-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Steve Mao |
| Maintainers | stevemao |
| Keywords | simple-preprocess, ENV, environment, if, endif, process, simple, fast, preprocess, pragma |

## Links

- npm: https://www.npmjs.com/package/simple-preprocess
- Repository: https://github.com/stevemao/simple-preprocess
- Issues: https://github.com/stevemao/simple-preprocess/issues
- npm.io page: https://npm.io/package/simple-preprocess

## Dependencies (4)

- [meow](https://npm.io/package/meow.md) ^3.1.0
- [chalk](https://npm.io/package/chalk.md) ^1.0.0
- [uncomment-it](https://npm.io/package/uncomment-it.md) ^1.0.0
- [concat-stream](https://npm.io/package/concat-stream.md) ^1.4.8

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-06-15
- 1.0.1 — 2015-05-26
- 1.0.0 — 2015-05-26
- 0.0.0 — 2015-05-26

## README

#  [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url]

> Preprocess html, js and css based off environment configuration


Originally based on [preprocess](https://github.com/jsoverson/preprocess). Created this because I only want to do simpler things with simpler config.


## Install

```sh
$ npm install --save simple-preprocess
```


## Usage

```js
var simplePreprocess = require('simple-preprocess');

simplePreprocess('/* @if dev */\nbody {\nbackground: red;\n}\n/* @endif */\n/* @if test*/\n/*body {\nbackground: yellow;\n}*/\n/* @endif*/', 'css', 'dev');
/*=> {
  data: 'body {\nbackground: red;\n}\n',
  retained: ['/* @if dev *\/\nbody {\nbackground: red;\n}\n/* @endif *\/\n'],
  stripped: ['/* @if test*\/\n/*body {\nbackground: yellow;\n}*\/\n/* @endif*\/']
} */
```

```sh
$ npm install --global simple-preprocess
$ simple-preprocess --help

  Usage
    simple-preprocess <input-path> <type>
    simple-preprocess <input-path> <type> <output-path>
    cat <input-path> | simple-preprocess <type>

  Example
    simple-preprocess env.css css -c 'prod,dev'
    simple-preprocess env.html html env.html
    cat env.css | simple-preprocess css -c test
    cat env.js | simple-preprocess js -c dev > processed.js

  Options
    -e, --env        Environment
    -v, --verbose    Verbose output
```


## API

### simplePreprocess(data, type, [env])

#### data

Type `string`

#### type

Type `string`

Posible values: `'html'`, `'js'` and `'css'`

#### env

Type `string` or `array`

Default: `process.env.NODE_ENV`


## License

MIT © [Steve Mao](https://github.com/stevemao)


[npm-image]: https://badge.fury.io/js/simple-preprocess.svg
[npm-url]: https://npmjs.org/package/simple-preprocess
[travis-image]: https://travis-ci.org/stevemao/simple-preprocess.svg?branch=master
[travis-url]: https://travis-ci.org/stevemao/simple-preprocess
[daviddm-image]: https://david-dm.org/stevemao/simple-preprocess.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/stevemao/simple-preprocess
[coveralls-image]: https://coveralls.io/repos/stevemao/simple-preprocess/badge.svg
[coveralls-url]: https://coveralls.io/r/stevemao/simple-preprocess

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