Skip to content

Commit 537afc7

Browse files
author
1000ch
committed
bug fix for multiple files
1 parent 5bab2de commit 537afc7

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "grunt-csscomb",
33
"description": "The grunt plugin for sorting CSS properties in specific order.",
4-
"version": "0.4.0",
4+
"version": "0.4.1",
55
"homepage": "https://github.com/csscomb/grunt-csscomb",
66
"author": {
77
"name": "Koji Ishimoto",

tasks/csscomb.js

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,21 @@
66
* Licensed under the MIT license.
77
*/
88
'use strict';
9+
module.exports = function(grunt) {
910

10-
module.exports = function (grunt) {
11-
12-
grunt.registerMultiTask('csscomb', 'Sorting CSS properties in specific order.', function () {
13-
11+
grunt.registerMultiTask('csscomb', 'Sorting CSS properties in specific order.', function() {
1412
var fs = require('fs'),
15-
path = require('path'),
16-
exec = require('child_process').exec;
17-
13+
path = require('path'),
14+
exec = require('child_process').exec;
1815
var done = this.async(),
19-
realPath = path.dirname(fs.realpathSync(__filename)),
20-
cssComb = 'php ' + realPath + '/lib/csscomb.php',
21-
fileSrc = '',
22-
fileDest = '',
23-
fileSort = '',
24-
options = this.options({
25-
sortOrder: null
26-
});
27-
16+
realPath = path.dirname(fs.realpathSync(__filename)),
17+
cssComb = 'php ' + realPath + '/lib/csscomb.php',
18+
fileSrc = '',
19+
fileDest = '',
20+
fileSort = '',
21+
options = this.options({
22+
sortOrder: null
23+
});
2824
if (options.sortOrder !== null) {
2925
if (grunt.file.exists(options.sortOrder)) {
3026
fileSort = ' -s ' + options.sortOrder;
@@ -35,40 +31,33 @@ module.exports = function (grunt) {
3531
}
3632

3733
function puts(error, stdout, stderr) {
38-
grunt.log.ok(stdout);
3934
if (error !== null) {
4035
grunt.log.error(error);
41-
done(false);
4236
} else {
43-
done(true);
37+
grunt.log.ok(stdout);
4438
}
4539
}
4640

47-
this.files.forEach(function (file) {
48-
fileSrc = file.src.filter(function (filepath) {
41+
this.files.forEach(function(file) {
42+
fileSrc = file.src.filter(function(filepath) {
4943
// Remove nonexistent files (it's up to you to filter or warn here).
5044
if (!grunt.file.exists(filepath)) {
5145
grunt.log.warn('Source file "' + filepath + '" not found.');
5246
return false;
5347
} else {
5448
return true;
5549
}
56-
}).map(function (filepath) {
50+
}).map(function(filepath) {
5751
return filepath;
5852
});
59-
6053
fileSrc = ' -i ' + fileSrc;
6154
if (file.dest !== null) {
6255
fileDest = ' -o ' + file.dest;
6356
}
64-
6557
var command = cssComb + fileSort + fileSrc + fileDest;
6658
exec(command, puts);
67-
6859
// grunt.log.writeln('`' + command + '` was initiated.');
69-
7060
});
71-
7261
});
7362

7463
};

0 commit comments

Comments
 (0)