Skip to content

Commit

Permalink
Drop dependency on deprecated gulp-util
Browse files Browse the repository at this point in the history
Closes #31
  • Loading branch information
TheDancingCode committed Jan 2, 2018
1 parent 739ed31 commit 07889ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -43,19 +44,19 @@ 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();
}

configPath = Comb.getCustomConfigPath(configPath || path.join(path.dirname(file.path), '.csscomb.json'));
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');
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; }';
Expand All @@ -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)
}));
Expand Down

0 comments on commit 07889ae

Please sign in to comment.