# striate

> Whitespace-friendly templating

Latest version **1.0.0** (published 2015-12-25) · ISC license · 0 weekly downloads

## Install

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

## 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.0 |
| Published | 2015-12-25 |
| First published | 2015-12-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Raine Lourie |
| Maintainers | raine |
| Keywords | whitespace, whitespace-sensitive, line, line-based, template, templating, language |

## Links

- npm: https://www.npmjs.com/package/striate
- Repository: https://github.com/metaraine/striate
- Homepage: https://github.com/metaraine/striate#readme
- Issues: https://github.com/metaraine/striate/issues
- npm.io page: https://npm.io/package/striate

## Dependencies (2)

- [ejs](https://npm.io/package/ejs.md) ^2.3.3
- [detect-indent](https://npm.io/package/detect-indent.md) ^3.0.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-12-25

## README

# striate
[![npm version](https://img.shields.io/npm/v/striate.svg)](https://npmjs.org/package/striate)
[![Build Status](https://travis-ci.org/metaraine/striate.svg?branch=master)](https://travis-ci.org/metaraine/striate)

**striate** is a thin wrapper for [ejs](https://github.com/mde/ejs) that is smart about line breaks, so you don't have to worry so much about delimiter placement.

## Install

```sh
$ npm install --save striate
```

## Usage

**striate** uses `>>` at the beginning of a line as the delimiter.

The entire line will be excluded from the output.

```js
var striate = require('striate')

var input = 
`var a = 10;

>> if(b) {
var b = 20;
>> }

var c = 30;`

var output1 = striate(input, { b: true })
/*
var a = 10;

var b = 20;

var c = 30;
*/

var output2 = striate(input, { b: false })
/*
var a = 10;

var c = 30;
*/
```

### API:

`var output = striate(input, data, options)`

* **input** - The input template (string)
* **data** - The data to be injected into the template (object)
* **options** - Options that are passed along to ejs (object)

Options:

```js
{
  // By default striate takes data and renders your template using ejs.
  // Set to false to output an unrendered ejs template instead.
  render: true,
  
  // If you prefer to indent all lines of code between >> delimeters without
  // it affecting the output, set this to true.
  indent: false
}
```

## Under the hood

**striate** transforms templates directly into ejs, but with whitespace placed correctly near delimiters.

```js
var a = 10;

>> if(b) {
var b = 20;
>> }

var c = 30;
```

is exactly the same as the following [ejs]() code:

```js
var a = 10;

<% if(b) {
%>var b = 20;
<% }
%>
var c = 30;
```

*Note: **striate**'s functionality is similar to slurp syntax `<%_ ... _%>` [introduced in ejs](https://github.com/mde/ejs/pull/105), but better for nested indentation.*


## License

ISC © [Raine Lourie](https://github.com/metaraine)

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