# br-processor

> Use for browserify transform and translate code of template engine or pre-proccessor to javascript string

Latest version **0.2.1** (published 2016-04-07) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install br-processor
pnpm add br-processor
yarn add br-processor
bun add br-processor
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2016-04-07 |
| First published | 2014-09-26 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | morlay |
| Maintainers | morlay |
| Keywords | browserify, transform, processor |

## Links

- npm: https://www.npmjs.com/package/br-processor
- Repository: https://github.com/morlay/br-processor
- Issues: https://github.com/morlay/br-processor/issues
- npm.io page: https://npm.io/package/br-processor

## Dependencies (1)

- [through](https://npm.io/package/through.md) ^2.3.8

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2016-04-07
- 0.1.1 — 2014-09-28
- 0.1.0 — 2014-09-26

## README

## br processor

Use for [browserify transform](https://github.com/substack/node-browserify#btransformopts-tr)
and translate code of template engine or pre-proccessor to javascript string.

[![Build Status](https://travis-ci.org/morlay/br-processor.svg?branch=master)](https://travis-ci.org/morlay/br-processor)
[![Dependencies](https://david-dm.org/morlay/br-processor.png)](https://david-dm.org/morlay/br-processor)

Support most pre-precessor which has sync api;

## Options

* `processorList`
  - `matchTest` to test file's ext and return boolean to tell browserfiy transform;
  - `process` a process translate **input string** to browserify js code;

## Demo

Then use for `b.transform(transformOpts,brProcessor)`


    var jade = require('jade');

    var transformOpts = {
      processorList: [{
        matchTest: function(file) {
          return /\.jade$/.exec(file);
        },
        process: function(inputString) {
          return html2jsWraper(jade.render(inputString, jadeOpts));
        }
      }]
    }

    function html2jsWraper(string) {
      return [
        'module.exports=',
        escapeContent(string),
        ';'
      ].join('\'')
    }

    function escapeContent(content) {
      return content.replace(/\\/g, '\\\\').replace(/'/g, '\\\'').replace(/\r?\n/g,
        '\\n\' +\n    \'');
    }

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