Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var fs = require('fs'),
path = require('path'),
es = require('event-stream'),
gutil = require('gulp-util'),
PluginError = require('plugin-error'),
colors = require('ansi-colors'),
glob = require('glob'),
applySourceMap = require('vinyl-sourcemaps-apply'),
stripBom = require('strip-bom');
Expand Down Expand Up @@ -43,7 +44,7 @@ module.exports = function (params) {
}

if (file.isStream()) {
throw new gutil.PluginError('gulp-include', 'stream not supported');
throw new PluginError('gulp-include', 'stream not supported');
}

if (file.isBuffer()) {
Expand Down Expand Up @@ -281,11 +282,11 @@ module.exports = function (params) {

function fileNotFoundError(includePath) {
if (hardFail) {
throw new gutil.PluginError('gulp-include', 'No files found matching ' + includePath);
throw new PluginError('gulp-include', 'No files found matching ' + includePath);
}else{
console.warn(
gutil.colors.yellow('WARN: ') +
gutil.colors.cyan('gulp-include') +
colors.yellow('WARN: ') +
colors.cyan('gulp-include') +
' - no files found matching ' + includePath
);
}
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@
"license": "MIT",
"devDependencies": {
"gulp": "~3.3.4",
"gulp-sourcemaps": "^1.1.4",
"mocha": "~1.17.0",
"should": "~2.1.1",
"gulp-sourcemaps": "^1.1.4",
"stream-assert": "^2.0.1"
"stream-assert": "^2.0.1",
"vinyl": "^2.1.0"
},
"dependencies": {
"ansi-colors": "^1.0.1",
"event-stream": "~3.1.0",
"glob": "^5.0.12",
"gulp-util": "~2.2.10",
"plugin-error": "^0.1.2",
"source-map": "^0.5.1",
"strip-bom": "^2.0.0",
"vinyl-sourcemaps-apply": "^0.2.0"
Expand Down
24 changes: 12 additions & 12 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var gutil = require("gulp-util"),
var Vinyl = require('vinyl'),
should = require("should"),
include = require("../index"),
fs = require("fs"),
Expand All @@ -13,7 +13,7 @@ var gutil = require("gulp-util"),
describe("gulp-include", function () {
describe("File including", function () {
it("should replace special comments with file contents", function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/basic-include.js",
contents: fs.readFileSync("test/fixtures/js/basic-include.js")
Expand All @@ -31,7 +31,7 @@ describe("gulp-include", function () {
});

it("should keep whitespace when including", function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/whitespace.js",
contents: fs.readFileSync("test/fixtures/js/whitespace.js")
Expand All @@ -49,7 +49,7 @@ describe("gulp-include", function () {
});

it("should include complex folder trees", function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/include-trees.js",
contents: fs.readFileSync("test/fixtures/js/include-trees.js")
Expand All @@ -68,7 +68,7 @@ describe("gulp-include", function () {
})

it("should not REQUIRE a file twice", function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/big-dummy-project-file.js",
contents: fs.readFileSync("test/fixtures/js/big-dummy-project-file.js")
Expand All @@ -86,7 +86,7 @@ describe("gulp-include", function () {
});

it("should pull files recursively", function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/recursive.js",
contents: fs.readFileSync("test/fixtures/js/recursive.js")
Expand All @@ -104,7 +104,7 @@ describe("gulp-include", function () {
});

it("should only include files with the set extensions, if provided", function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/options-extensions.js",
contents: fs.readFileSync("test/fixtures/js/options-extensions.js")
Expand All @@ -124,7 +124,7 @@ describe("gulp-include", function () {
});

it("should work with html-comments", function(done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/html/basic-include.html",
contents: fs.readFileSync("test/fixtures/html/basic-include.html")
Expand Down Expand Up @@ -155,7 +155,7 @@ describe("gulp-include", function () {
});

it('should strip unicode byte order marks from included files', function (done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/html/basic-include-with-unicode-BOM.html",
contents: fs.readFileSync("test/fixtures/html/basic-include-with-unicode-BOM.html")
Expand All @@ -174,7 +174,7 @@ describe("gulp-include", function () {
})

it("should include from set includePaths", function(done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/include-path.js",
contents: fs.readFileSync("test/fixtures/js/include-path.js")
Expand All @@ -198,7 +198,7 @@ describe("gulp-include", function () {
})

it("should throw an error if no match is found with hardFail: true", function(done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/include-fail.js",
contents: fs.readFileSync("test/fixtures/js/include-fail.js")
Expand All @@ -214,7 +214,7 @@ describe("gulp-include", function () {
})

it("should not throw an error if no match is found with hardFail: false", function(done) {
var file = new gutil.File({
var file = new Vinyl({
base: "test/fixtures/",
path: "test/fixtures/js/include-fail.js",
contents: fs.readFileSync("test/fixtures/js/include-fail.js")
Expand Down