Skip to content

maxgalbu/gulp-ractive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-ractive Build Status

Installation and Ractive versions

This branch of the plugin uses ractive 0.9.x. To install this version, use:

npm install [email protected] --save-dev

Usage

Simple example:

var gulp = require('gulp'),
	ractive = require('gulp-ractive');

gulp.task('ractive_templates', function() {
	return gulp.src('templates/*.ractive')
		.pipe(ractive())
		.pipe(gulp.dest('templates/compiled/'));
});

Using options

var gulp = require('gulp'),
	ractive = require('gulp-ractive');

gulp.task('ractive_templates', function() {
	return gulp.src('templates/*.ractive')
		.pipe(ractive({
		  preserveWhitespace: true
		}))
		.pipe(gulp.dest('templates/compiled/'));
});

Example with compiled files in the same folder (using gulp-rename):

var gulp = require('gulp'),
	rename = require('gulp-rename'),
	ractive = require('gulp-ractive');

gulp.task('ractive_templates', function() {
	return gulp.src('templates/*.ractive')
		.pipe(ractive())
		.pipe(rename({
			extname: ".ractivecompiled",
		}))
		.pipe(gulp.dest('templates/'));
});

Error handling

There's no need to use gulp-plumber to catch errors, gulp-ractive logs errors using console.warn instead of crashing gulp.

Options

You can pass to ractive() the same options that you pass when creating a new Ractive object (see the docs from ractivejs.org: http://docs.ractivejs.org/latest/options).

Remember that not all options are meaningful to Ractive.parse() (eg: data or computed).

About

compile Ractive templates

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •