<commit_before># exposify [![build status](https://secure.travis-ci.org/thlorenz/exposify.png)](http://travis-ci.org/thlorenz/exposify)

browserify transform that exposes globals added via a script tag as modules so they can be required.

```html
<!-- index.html -->
<head>
  <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js"></script>
  <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
  [..]
```

```js
// main.js
var $ = require('jquery')
  , THREE = require('three')

console.log('THREE revision: ', THREE.REVISION);
console.log('jquery version: ', $().jquery);
```

#### Building via JavaScript

```js
var browserify = require('browserify');

// configure what we want to expose
var exposeConfig = { expose: { jquery: '$', three: 'THREE' } };

browserify()
  .require(require.resolve('./main'), { entry: true })
  .transform('exposify', exposeConfig)
  .bundle({ debug: true })
  .pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'), 'utf8'))
```

#### Building via Commandline

Using the `EXPOSIFY_CONFIG` environment variable:

```sh
EXPOSIFY_CONFIG='{ "jquery": "$", "three": "THREE" }' browserify --debug -t exposify main.js > bundle.js
```

Or using a Browserify transform option:

```sh
browserify --debug -t [ exposify --expose [ --jquery=$ --three=THREE ] ] exposify main > bundle.js
```

Or use it via [browserify-shim](https://github.com/thlorenz/browserify-shim) which allows you to provide exposify config
inside your `package.json` among other features.

## Installation
<commit_msg>Clarify relationship between b-shim and exposify<commit_after># exposify [![build status](https://secure.travis-ci.org/thlorenz/exposify.png)](http://travis-ci.org/thlorenz/exposify)

browserify transform that exposes globals added via a script tag as modules so they can be required.

```html
<!-- index.html -->
<head>
  <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js"></script>
  <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
  [..]
```

```js
// main.js
var $ = require('jquery')
  , THREE = require('three')

console.log('THREE revision: ', THREE.REVISION);
console.log('jquery version: ', $().jquery);
```

#### Building via JavaScript

```js
var browserify = require('browserify');

// configure what we want to expose
var exposeConfig = { expose: { jquery: '$', three: 'THREE' } };

browserify()
  .require(require.resolve('./main'), { entry: true })
  .transform('exposify', exposeConfig)
  .bundle({ debug: true })
  .pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'), 'utf8'))
```

#### Building via Commandline

Using the `EXPOSIFY_CONFIG` environment variable:

```sh
EXPOSIFY_CONFIG='{ "jquery": "$", "three": "THREE" }' browserify --debug -t exposify main.js > bundle.js
```

Or using a Browserify transform option:

```sh
browserify --debug -t [ exposify --expose [ --jquery=$ --three=THREE ] ] exposify main > bundle.js
```

Or use [browserify-shim](https://github.com/thlorenz/browserify-shim) which can [configure exposify in `package.json`](https://github.com/thlorenz/browserify-shim#a-expose-global-variables-via-global) among other features.

## Installation

{'fraction_non_alphanumeric': 0.18541033434650456, 'fraction_numerical': 0.00364741641337386, 'mean_word_length': 4.6160409556314, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5023767', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1089, 'n_words': 255}