From 07889aeae7989307e21478b0538e8c4b33a776da Mon Sep 17 00:00:00 2001 From: Thomas Vantuycom Date: Tue, 2 Jan 2018 13:04:57 +0100 Subject: [PATCH] Drop dependency on deprecated `gulp-util` Closes #31 --- index.js | 11 ++++++----- package.json | 7 +++++-- test.js | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 7b86f26..8670cdd 100644 --- a/index.js +++ b/index.js @@ -7,10 +7,11 @@ var Comb = require('csscomb'); var fs = require('fs'); -var gutil = require('gulp-util'); var path = require('path'); var through = require('through2'); -var PluginError = gutil.PluginError; +var PluginError = require('plugin-error'); +var fancyLog = require('fancy-log'); +var colors = require('ansi-colors'); // Constants var PLUGIN_NAME = 'gulp-csscomb'; @@ -43,11 +44,11 @@ function Plugin(configPath, options) { } else if (file.isBuffer() && SUPPORTED_EXTENSIONS.indexOf(path.extname(file.path)) !== -1) { if (verbose) { - gutil.log(PLUGIN_NAME, 'Processing ' + gutil.colors.magenta(file.path)); + fancyLog(PLUGIN_NAME, 'Processing ' + colors.magenta(file.path)); } if (configPath && !fs.existsSync(configPath)) { - this.emit('error', new PluginError(PLUGIN_NAME, 'Configuration file not found: ' + gutil.colors.magenta(configPath))); + this.emit('error', new PluginError(PLUGIN_NAME, 'Configuration file not found: ' + colors.magenta(configPath))); return cb(); } @@ -55,7 +56,7 @@ function Plugin(configPath, options) { var config = Comb.getCustomConfig(configPath); if (verbose) { - gutil.log(PLUGIN_NAME, 'Using configuration file ' + gutil.colors.magenta(configPath)); + fancyLog(PLUGIN_NAME, 'Using configuration file ' + colors.magenta(configPath)); } var comb = new Comb(config || 'csscomb'); diff --git a/package.json b/package.json index aade2b9..12a058c 100644 --- a/package.json +++ b/package.json @@ -28,13 +28,16 @@ "index.js" ], "dependencies": { + "ansi-colors": "^1.0.1", "csscomb": "^3.1.7", - "gulp-util": "^3.0.7", + "fancy-log": "^1.3.2", + "plugin-error": "^0.1.2", "through2": "^2.0.1" }, "devDependencies": { "jshint": "^2.9.3", - "mocha": "^3.0.2" + "mocha": "^3.0.2", + "vinyl": "^2.1.0" }, "engines": { "node": ">= 0.9.0" diff --git a/test.js b/test.js index 1695a57..c808e24 100644 --- a/test.js +++ b/test.js @@ -8,7 +8,7 @@ 'use strict'; var assert = require('assert'); -var gutil = require('gulp-util'); +var Vinyl = require('vinyl'); var csscomb = require('./index'); var cssinput = 'h1 { color: yellow; } \n h1 { font-size: 2em; }'; @@ -30,7 +30,7 @@ describe('gulp-csscomb', function() { cb(); }); - stream.write(new gutil.File({ + stream.write(new Vinyl({ path: 'style.css', contents: new Buffer(cssinput) }));