# jeml-example

> ## Installation

Latest version **0.0.1** (published 2014-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install jeml-example
pnpm add jeml-example
yarn add jeml-example
bun add jeml-example
```

## 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.0.1 |
| Published | 2014-06-26 |
| First published | 2014-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | gyson |
| Maintainers | gyson |

## Links

- npm: https://www.npmjs.com/package/jeml-example
- npm.io page: https://npm.io/package/jeml-example

## Dependencies (4)

- [gulp](https://npm.io/package/gulp.md) ^3.8.2
- [gulp-jeml](https://npm.io/package/gulp-jeml.md) 0.0.1
- [js-beautify](https://npm.io/package/js-beautify.md) ^1.5.1
- [gulp-beautify](https://npm.io/package/gulp-beautify.md) ^1.1.0

## Recent versions

- 0.0.1 (latest) — 2014-06-26

## README

# jeml-example

## Installation

```
$ npm install jeml-example
```

## example
in `layout.jeml`:

```js
default (title, body) {
    html: {
        head: {
            title: `title`
            script(src="some_address...")
        }
        body: {
            `body`
        }
    }
}
```

in `view.jeml`:

```js
import layout "./layout" // import default mixin from layout.jeml

default {
    % var title = "I am title";
    `layout(title, body())`
}

mixin body {
    p: "I am body"

    % var users = {
    %     "foo": "I am foo",
    %     "bar": "I am bar"
    % }

    for name: introduction in `users` {
        p: { "name: " `name`}
        p: { "introduce: " `introduction`}
    }
}

export print_name (name) {
    p: { "my name is " `name` }
}
```

in `main.js`:

```js
// you need to compile *.jeml file to *.js file before `require`
var view = require('jeml-example');
var beautify = require('js-beautify').html;

console.log(beautify(view()));
console.log(beautify(view.print_name("Gyson")));
/* output:
<html>

<head>
    <title>I am title</title>
    <script src="some_address..."></script>
</head>

<body>
    <p>I am body</p>
    <p>name: foo</p>
    <p>introduce: I am foo</p>
    <p>name: bar</p>
    <p>introduce: I am bar</p>
</body>

</html>
*/

console.log(view.print_name("Gyson"));
/* output:
<p>my name is Gyson</p>
*/

```

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