Skip to content
Open
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
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var fancyLog = require('fancy-log');
var colors = require('ansi-colors');

// Constants
var PLUGIN_NAME = 'gulp-csscomb';
var PLUGIN_NAME = 'gulp-csscomb2';
var SUPPORTED_EXTENSIONS = ['.css', '.sass', '.scss', '.less'];

// Plugin level function (dealing with files)
Expand All @@ -24,7 +24,9 @@ function Plugin(configPath, options) {
options = configPath;
configPath = options.configPath;
} else if (arguments.length == 2 && typeof options === 'boolean') {
options = { verbose: options }; // for backward compatibility
options = {
verbose: options
}; // for backward compatibility
}

options = options || {};
Expand All @@ -34,7 +36,7 @@ function Plugin(configPath, options) {
//var lint = options.lint || false; // TODO: Report about found issues in style sheets

// Create a stream through which each file will pass
var stream = through.obj(function(file, enc, cb) {
var stream = through.obj(function (file, enc, cb) {

if (file.isNull()) {
// Do nothing
Expand Down Expand Up @@ -63,12 +65,14 @@ function Plugin(configPath, options) {
var syntax = options.syntax || file.path.split('.').pop();

try {
var output = comb.processString(
var promisedOutput = comb.processString(
file.contents.toString('utf8'), {
syntax: syntax,
filename: file.path
});
file.contents = new Buffer(output);
promisedOutput.then(function (processedString) {
file.contents = new Buffer(processedString);
});
} catch (err) {
this.emit('error', new PluginError(PLUGIN_NAME, file.path + '\n' + err));
}
Expand Down
Loading