0.1.5 • Published 9 years ago

gulp-jsmart v0.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

gulp-jsmart

NPM version Build Status Coverage Status Dependency Status

jSmart plugin for gulp, based on gulp-template and grunt-jsmart

Install

npm install --save-dev gulp-jsmart

Usage

gulpfile.js

This example shows how one might convert glob of templates, and rename them with gulp-rename

var gulp = require('gulp');
var jsmart = require('gulp-jsmart');
var rename = require('gulp-rename');
var options = {
  templatePath: 'app/templates/',
};

gulp.task('default', function () {
	return gulp.src('src/templates/*.tpl')
		.pipe(jsmart('src/data/', options))
		.pipe(rename({extname: '.html'}))
		.pipe(gulp.dest('dist'));
});

API

jsmart(data, options)

data

Type: String|Object Default value: undefined

A value where you can pass your data as

  1. Object
  2. File
  3. Directory

If you pass your data as JSON-File or Directory Containing JSON-Files, the first Level in Object-Hierarchy is the Name of the JSON-File (Underscores, Hyphens etc. are converted to camelCase!).

E.g. Your Filename is book-store.json with the content

{
   "greeting": "Hi, there are some JScript books you may find interesting:"
}

you must use it in your template like this:

<h1>{$bookStore.greeting}</h1>

options

Type: Object

options.templatePath

Type: String Default value: undefined

A string value where you can define a Path in your Project where jSmart should load Templates for Inheritance.

License

MIT License

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago