diff --git a/index.js b/index.js index d45bffc..6668c06 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -var gutil = require('gulp-util'); +var PluginError = require('plugin-error'); var through = require('through2'); var Handlebars = require('handlebars'); var fs = require('fs'); @@ -114,7 +114,7 @@ function handlebars(data, opts) { } if (file.isStream()) { - this.emit('error', new gutil.PluginError('gulp-compile-handlebars', 'Streaming not supported')); + this.emit('error', new PluginError('gulp-compile-handlebars', 'Streaming not supported')); return cb(); } @@ -131,7 +131,7 @@ function handlebars(data, opts) { var template = hb.compile(fileContents, options.compile); file.contents = new Buffer(template(_data)); } catch (err) { - this.emit('error', new gutil.PluginError('gulp-compile-handlebars', err)); + this.emit('error', new PluginError('gulp-compile-handlebars', err)); } this.push(file); diff --git a/package.json b/package.json index fee9f46..1c752e5 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,12 @@ "rendering" ], "dependencies": { - "gulp-util": "^3.0.3", - "through2": "^0.6.3", - "handlebars": ">=3.0.0" + "handlebars": ">=3.0.0", + "plugin-error": "^0.1.2", + "through2": "^0.6.3" }, "devDependencies": { - "mocha": "*" + "mocha": "*", + "vinyl": "^2.1.0" } } diff --git a/test/test.js b/test/test.js index 0742586..949622e 100644 --- a/test/test.js +++ b/test/test.js @@ -1,6 +1,6 @@ 'use strict'; var assert = require('assert'); -var gutil = require('gulp-util'); +var Vinyl = require('vinyl'); var template = require('../index'); it('should compile Handlebars templates', function (cb) { @@ -19,7 +19,7 @@ it('should compile Handlebars templates', function (cb) { cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('{{> header}}{{#each people}}
  • {{.}}
  • {{/each}} {{toLower message}}') })); @@ -42,7 +42,7 @@ it('should compile Handlebars templates, and ignore unknown partials', function cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('{{> header}}{{#each people}}
  • {{.}}
  • {{/each}} {{toLower message}}') })); @@ -57,7 +57,7 @@ it('should compile Handlebars templates, and use batched partials', function (cb cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('{{> header-test}}') })); @@ -72,7 +72,7 @@ it('should compile Handlebars templates, and use batched NESTED partials', funct cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('{{> mobile/header-test}}') })); @@ -87,7 +87,7 @@ it('should compile Handlebars templates, and use multiple batched NESTED partial cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('{{> desktop/header-test}}') })); @@ -103,7 +103,7 @@ it('should compile Handlebars templates with no helpers or partials', function ( cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('{{#each people}}
  • {{.}}
  • {{/each}}') })); @@ -119,7 +119,7 @@ it('should use file.data if available', function (cb) { cb(); }); - var file = new gutil.File({ + var file = new Vinyl({ contents: new Buffer('
    {{foo}} {{bar}}
    ') }); file.data = { bar: 'BAZ' }; @@ -138,7 +138,7 @@ it('should not require a default data object', function (cb) { cb(); }); - var file = new gutil.File({ + var file = new Vinyl({ contents: new Buffer('
    {{foo}}
    ') }); file.data = { foo: 'BAZ' };