# jsttojs

> A node.js module for precompile JavaScript templates (ex. mustache or jQuery.tmpl) to one file

Latest version **1.2.1** (published 2015-08-15) · 0 weekly downloads

## Install

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

Provides the command `jsttojs`.

## 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.2.1 |
| Published | 2015-08-15 |
| First published | 2012-11-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.6.x |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Alexey Kupriyanenko |
| Maintainers | upwards |
| Keywords | jst, template, precompile, compile, mustache |

## Links

- npm: https://www.npmjs.com/package/jsttojs
- Repository: https://github.com/kupriyanenko/jsttojs
- Homepage: http://upwards.github.com/jsttojs/
- Issues: https://github.com/kupriyanenko/jsttojs/issues
- npm.io page: https://npm.io/package/jsttojs

## Dependencies (4)

- [walk](https://npm.io/package/walk.md) ~2.2.x
- [watch](https://npm.io/package/watch.md) ~0.8.x
- [moment](https://npm.io/package/moment.md) ~2.1.x
- [commander](https://npm.io/package/commander.md) ~1.0.x

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2015-08-15
- 1.2.0 — 2014-01-04
- 1.1.3 — 2014-01-04
- 0.1.2 — 2013-09-10
- 0.1.1 — 2013-01-30
- 0.1.0 — 2013-01-30
- 0.0.3 — 2012-12-21
- 0.0.2 — 2012-11-08
- 0.0.1 — 2012-11-03

## README

jsttojs
=======

[![NPM version](https://badge.fury.io/js/jsttojs.png)](http://badge.fury.io/js/jsttojs)

A node.js module for precompile JavaScript templates (ex. mustache or jQuery.tmpl) to one file.


You can to precompile some static mustache, hogan.js, jQuery.tmpl, underscore.js or any other templates and include them in generated javascript function that could be stitched and compressed in a single file.

And if you set the flag --watch, you can compile templates automatically!

Installation
-----

    $ npm install jsttojs -g


Usage
-----

jsttojs allows templates to be precompiled and included in javascript code

```
Precompile JavaScript templates.
Usage: jsttojs <input> <output> [options]

Options:

  -h, --help        output usage information
  -V, --version     output the version number
  -e, --ext <n>     extension for templates, default "jst"
  -n, --name <n>    name variable stores temapltes, default "JSTmpl"
  -w, --watch       watch files and automatic compile output file
  -r, --removebreak remove line breaks
  -a, --amd         wrap templates in AMD module
  -o, --onlyname    use as a key only file name, without directory

Examples:

  $ jsttojs templates compiled/templates/index.js --ext mustache --watch
```

### Use with grunt ###

Use it with [grunt](http://gruntjs.com/), install [grunt-jsttojs](https://github.com/kupriyanenko/grunt-jsttojs) and add this line to your project's Gruntfile:

```javascript
grunt.loadNpmTasks('grunt-jsttojs');
```

Samples
-----

Templates:

```javascript
// tamplates/index.jst
Hello world {{ username }}
second line
```

```javascript
// tamplates/video/index.jst
Hello {{ username }} on index video page
```

Run precompile templates

    $ jsttojs templates compiled/templates/index.js --name MyGlobalVariable

Output:

```javascript
// compiled/templates/index.js
window.MyGlobalVariable = {
  "index" : "Hello world {{ username }}\nsecond line",
  "video/index" : "Hello {{ username }} on index video page"
}
```

License
-----

Copyright (c) 2012 Alexey Kupriyanenko a.kupriyanenko@gmail.com

jsttojs is released under the MIT license.

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