# vashify

> compile vash templates for use with browserify

Latest version **1.0.2** (published 2018-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install vashify
pnpm add vashify
yarn add vashify
bun add vashify
```

## 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 | 2018-01-23 |
| First published | 2014-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | mike chevett |
| Maintainers | chevett |
| Keywords | vash, razor, template, browserify |

## Links

- npm: https://www.npmjs.com/package/vashify
- Repository: https://github.com/chevett/vashify
- Issues: https://github.com/chevett/vashify/issues
- npm.io page: https://npm.io/package/vashify

## Dependencies (4)

- [vash](https://npm.io/package/vash.md) ^0.12.4
- [through](https://npm.io/package/through.md) ^2.3.8
- [browserify](https://npm.io/package/browserify.md) ^12.0.1
- [object-assign](https://npm.io/package/object-assign.md) ^4.0.1

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

- 1.0.2 (latest) — 2018-01-23
- 1.0.1 — 2015-11-23
- 1.0.0 — 2015-11-11
- 0.4.0 — 2014-11-10
- 0.3.3 — 2014-07-05
- 0.3.2 — 2014-07-05
- 0.3.1 — 2014-05-14
- 0.2.1 — 2014-01-13
- 0.2.0 — 2014-01-10
- 0.1.3 — 2014-01-05
- 0.1.2 — 2014-01-05
- 0.1.0 — 2014-01-05
- 0.0.2 — 2014-01-05
- 0.0.1 — 2014-01-05
- 0.0.0 — 2014-01-05

## README

vashify [![Build Status](https://travis-ci.org/chevett/vashify.png)](https://travis-ci.org/chevett/vashify)
=======

Use [Vash](https://github.com/kirbysayshi/vash) with [Browserify](https://github.com/substack/node-browserify) and get your templates compiled during the transform
````js
npm install vashify
````
######your-file.js
````js
var template = require('./your-template.vash');
var $ = require('jquery');

$('body').append(template({ name: 'Mike', traits: ['bro', 'tall']}));
````
######your-template.vash
```html
<h1>@model.name</h1>
<ul>
  @model.traits.forEach(function(t){ 
    <li>You are @t</t>
  })
</div>
````
######do the transform
````
browserify -t vashify your-file.js > bundle.js
````

using helpers
-------------
######require vash-runtime to register helpers
````js
var vash = require('vash-runtime');
var tmpl = require('./your-template.vash');

vash.helpers.fullName = function(model){
  return model.first + ' ' + model.last;
};

tmpl({first:'Barbra', last: 'Streisand';});
````
######calling the helpers
````html
@html.fullName(model)... @html.fullName(model).
````


What is happening?
------------------
Module references like require('*.vash') files will be intercepted during the browserify transform.  Once intercepted, the template is compiled and a new module that exports the complied template function is generated.

The vash runtime is automatically included one time, the first time a vash file is required.

This means templates that are required multiple times will only appear in the bundle once and the vash runtime is only included once... which is good for business.

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