Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the gulp-util dependency to avoid it causing the deprecation warning #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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();
}

Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"rendering"
],
"dependencies": {
"gulp-util": "^3.0.3",
"handlebars": ">=3.0.0",
"plugin-error": "^0.1.2",
"through2": "^0.6.3",
"handlebars": ">=3.0.0"
"vinyl": "^2.1.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should move vinyl to the devDependencies, since it's only used in the tests.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, forgot about that 👍

},
"devDependencies": {
"mocha": "*"
Expand Down
18 changes: 9 additions & 9 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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}}<li>{{.}}</li>{{/each}} {{toLower message}}')
}));

Expand All @@ -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}}<li>{{.}}</li>{{/each}} {{toLower message}}')
}));

Expand All @@ -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}}')
}));

Expand All @@ -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}}')
}));

Expand All @@ -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}}')
}));

Expand All @@ -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}}<li>{{.}}</li>{{/each}}')
}));

Expand All @@ -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('<div>{{foo}} {{bar}}</div>')
});
file.data = { bar: 'BAZ' };
Expand All @@ -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('<div>{{foo}}</div>')
});
file.data = { foo: 'BAZ' };
Expand Down