koistya / gulp-csscomb

CSScomb plugin for Gulp.js. Formats CSS according to a pre-defined coding style.
http://csscomb.com
MIT License
122 stars 25 forks source link

Custom .csscomb.json doesn't work. #19

Open ghost opened 9 years ago

ghost commented 9 years ago

I have kept .csscomb.json in the root.

This is the code I have in gulpfile.js which doesn't work:

var gulp = require('gulp'),
sass = require('gulp-sass'),
csscomb = require('gulp-csscomb');

gulp.task('styles', function() {
    gulp.src('assets/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(csscomb('.csscomb.json'))
    .pipe(gulp.dest('assets/css/'));
});

gulp.task('default', function() {
  // place code for your default task here
  gulp.watch('assets/sass/**/*.scss',['styles']);
});

Niether this works:

var gulp = require('gulp'),
sass = require('gulp-sass'),
csscomb = require('gulp-csscomb');

gulp.task('styles', function() {
    gulp.src('assets/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(csscomb())
    .pipe(gulp.dest('assets/css/'));
});

gulp.task('default', function() {
  // place code for your default task here
  gulp.watch('assets/sass/**/*.scss',['styles']);
});

Nor this:

var gulp = require('gulp'),
sass = require('gulp-sass'),
csscomb = require('gulp-csscomb');

gulp.task('styles', function() {
    gulp.src('assets/sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(csscomb('./.csscomb.json'))
    .pipe(gulp.dest('assets/css/'));
});

gulp.task('default', function() {
  // place code for your default task here
  gulp.watch('assets/sass/**/*.scss',['styles']);
});

No matter what I do, It applies the default config.

kiseln commented 9 years ago

Same issue. However, it works on 3.0.2.

wroughtec commented 8 years ago

I thought I had the same issue however it turned out my config was not valid (comments threw an error) only worked it out by overwriting the comb in the config in the node module so basically mine was failing silently when in root the error displayed once I had overwritten the default

klierik commented 8 years ago

Have the same issue. I took my default .csscomb.json file that i use in other project (for example with grunt-csscomb) and copy into current project, that based on Gulp. gulp-csscomb do not take my config, it use default instead.

ps: file placement correct — the are in the same folder:

-rw-r--r--   1 klierik  staff    8727 10 ноя 10:32 .csscomb.json
...
-rw-r--r--   1 klierik  staff    7884 10 ноя 10:44 gulpfile.js

pss: "gulp-csscomb": "^3.0.6",

update: problem found — it was syntax error in my .csscomb.json. 3.0.2 version shot error, 3.0.6 — not show error

scoobster17 commented 7 years ago

Realise this is an old issue but I'm having this issue even now, but it seems it is only on Windows. Trying the same code from the same repo on a mac works fine.

As @srahulprdxn says, neither of these two options work:

.pipe(csscomb())

or

.pipe(csscomb('./.csscomb.json'))

Looking at the source code I also tried the below to no avail:

.pipe(csscomb( { configPath: './.csscomb.json'  } ))
Paul-Hume commented 7 years ago

To fix this I've rolled back to use 3.0.2 and now all is working fine. This does really need fixing though.