Skip to content

Commit 735749f

Browse files
committed
Added basic usage of .css file as config
1 parent d03a867 commit 735749f

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

lib/cli.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,16 @@ if (!program.args.length) {
2525
var configPath = program.config || (process.cwd() + '/.csscomb.json');
2626

2727
if (fs.existsSync(configPath)) {
28-
var comb = new Comb();
29-
var config = require(configPath);
28+
var comb;
29+
var config;
30+
if (configPath.match(/\.css$/)) {
31+
comb = new Comb();
32+
comb.detect();
33+
config = comb.processFile(configPath);
34+
} else {
35+
config = require(configPath);
36+
}
37+
comb = new Comb();
3038

3139
console.time('spent');
3240

lib/csscomb.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var gonzales = require('gonzales-pe');
22
var minimatch = require('minimatch');
33
var vow = require('vow');
4+
var fs = require('fs');
45
var vfs = require('vow-fs');
56
var doNothing = function() {};
67

@@ -173,6 +174,9 @@ Comb.prototype = {
173174
*/
174175
processFile: function(path) {
175176
var _this = this;
177+
if (_this._detect) {
178+
return _this.processString(fs.readFileSync(path, 'utf8'), path);
179+
}
176180
if (this._shouldProcessFile(path)) {
177181
return vfs.read(path, 'utf8').then(function(data) {
178182
var syntax = path.split('.').pop();

0 commit comments

Comments
 (0)