<commit_before>[![Build
Status](https://travis-ci.org/riot/riotify.svg)](https://travis-ci.org/riot/riotify)

# riotify

"riotify" is a browserify transformer for [riot](https://muut.com/riotjs) ".tag" files.

## Installation

```bash
$ npm install riotify
```

## Usage

This module is meant to be used together with
[browserify](http://browserify.org) or
[module-deps](https://github.com/substack/module-deps):

Either of the two commands below result creates the same result:

```bash
$ browserify -t riotify app.js
$ module-deps -t riotify app.js | browser-pack
```

Example `app.js`:

```javascript
var riot = require('riot')
var todo = require('./todo.tag')
riot.mount(todo)
```

Example `todo.tag`:

```html
<todo>
  <div each={ items }>
    <h3>{ title }</h3>
  </div>

  // a tag file can contain any JavaScript, even require()
  var resources = require('../resources.json')    
  this.items = [ { title: resources.en.first }, { title: resources.en.second } ]
</todo>
```

Note that your tag files actually need to have the extension ".tag".

### Compile Options

This plugin can give riot's compile options.

```bash
$ browserify -t [ riotify --type coffeescript --template jade ] app.js
```

You can also configure it in package.json

```json
{
    "name": "my-package",
    "browserify": {
        "transform": [
            [ "riotify", {"type": "coffeescript", "template": "jade" } ],
        ]
    }
}
```

#### Available option

- compact: `Boolean`
  - Minify `</p> <p>` to `</p><p>`
- expr: `Boolean`
  - Run expressions trough parser defined with `--type`
- type: `String, coffeescript | cs | es6 | none`
  - JavaScript pre-processor
- template: `String, jade`
  - HTML pre-processor
- ext: `String`
  - custom extension, you’re free to use any file extension for your tags (instead of default .tag):

See more: https://muut.com/riotjs/compiler.html

### With gulp.js

```javascript
var gulp       = require('gulp');
var browserify = require('browserify');
var riotify    = require('riotify');
var source     = require('vinyl-source-stream');

gulp.task('browserify', function(){
  browserify({ entries: ['src/app.js'] })
  .transform(riotify, { template: 'jade' }) // pass options if you need
  .bundle()
  .pipe(source('app.js'))
  .pipe(gulp.dest('dist/'))
});
```

These are the simplest cases. `uglify` and `sourcemaps` would be needed.

## Tests

```bash
$ npm test
```
<commit_msg>updated: links from muut to github<commit_after>[![Build
Status](https://travis-ci.org/riot/riotify.svg)](https://travis-ci.org/riot/riotify)

# riotify

"riotify" is a browserify transformer for [riot](https://github.com/riot/riot) ".tag" files.

## Installation

```bash
$ npm install riotify
```

## Usage

This module is meant to be used together with
[browserify](http://browserify.org) or
[module-deps](https://github.com/substack/module-deps):

Either of the two commands below result creates the same result:

```bash
$ browserify -t riotify app.js
$ module-deps -t riotify app.js | browser-pack
```

Example `app.js`:

```javascript
var riot = require('riot')
var todo = require('./todo.tag')
riot.mount(todo)
```

Example `todo.tag`:

```html
<todo>
  <div each={ items }>
    <h3>{ title }</h3>
  </div>

  // a tag file can contain any JavaScript, even require()
  var resources = require('../resources.json')
  this.items = [ { title: resources.en.first }, { title: resources.en.second } ]
</todo>
```

Note that your tag files actually need to have the extension ".tag".

### Compile Options

This plugin can give riot's compile options.

```bash
$ browserify -t [ riotify --type coffeescript --template jade ] app.js
```

You can also configure it in package.json

```json
{
    "name": "my-package",
    "browserify": {
        "transform": [
            [ "riotify", {"type": "coffeescript", "template": "jade" } ],
        ]
    }
}
```

#### Available option

- compact: `Boolean`
  - Minify `</p> <p>` to `</p><p>`
- expr: `Boolean`
  - Run expressions trough parser defined with `--type`
- type: `String, coffeescript | cs | es6 | none`
  - JavaScript pre-processor
- template: `String, jade`
  - HTML pre-processor
- ext: `String`
  - custom extension, you’re free to use any file extension for your tags (instead of default .tag):

See more: https://github.com/riot/compiler

### With gulp.js

```javascript
var gulp       = require('gulp');
var browserify = require('browserify');
var riotify    = require('riotify');
var source     = require('vinyl-source-stream');

gulp.task('browserify', function(){
  browserify({ entries: ['src/app.js'] })
  .transform(riotify, { template: 'jade' }) // pass options if you need
  .bundle()
  .pipe(source('app.js'))
  .pipe(gulp.dest('dist/'))
});
```

These are the simplest cases. `uglify` and `sourcemaps` would be needed.

## Tests

```bash
$ npm test
```

{'fraction_non_alphanumeric': 0.17284206168495136, 'fraction_numerical': 0.001241978886358932, 'mean_word_length': 3.584440227703985, 'pattern_counts': {'":': 10, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 10, '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': '272315', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1594, 'n_words': 475}