Open mattijsbliek opened 10 years ago
Temporary solution
I found out you can work around this by prepending the globally available __dirname
variable to your config location like so:
gulp.task('scss-lint', function() {
gulp.src(paths.cssSrc + '/**/*.scss')
.pipe(cache('scsslint'))
.pipe(scsslint({'config': __dirname + '/.scss-lint.yml'})).on('error', handleError);
});
It's strange, the same code works well for me... Do you run gulp from another directory?
Sorry for the late reply!
I did some more debugging, and the problem seems to occur when you run scss-lint as a dependency of another task. I can run it fine on it's own, but as soon as I run gulp.task('sass', ['scss-lint'], function() { ... });
it seems to look for .scss-lint.yml
in a different directory.
Stack trace:
Error in plugin 'gulp-scss-lint'
Error code 1
Error: Command failed: /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/config.rb:184:in `initialize': No such file or directory - .scss-lint.yml (Errno::ENOENT)
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/config.rb:184:in `open'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/config.rb:184:in `load_file_contents'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/config.rb:65:in `load_options_hash_from_file'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/config.rb:24:in `load'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/cli.rb:127:in `setup_configuration'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/lib/scss_lint/cli.rb:41:in `parse_arguments'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/bin/scss-lint:7:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/bin/scss-lint:6:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/scss-lint-0.29.0/bin/scss-lint:6:in `<top (required)>'
from /usr/bin/scss-lint:23:in `load'
from /usr/bin/scss-lint:23:in `<main>'
I tried to do the same and it's works well. Could you make some changes in the plugin?
Edit ./node_modules/gulp-scss-lint/index.js in the line 59 add console.log(process.cwd()); console.log(command);
and tell me what it returns.
Thanks!
It returns scss-lint /Users/username/Sites/sitename/public/css/sass/base.scss [...] --config /.scss-lint.yml --format XML
and then errors with the same error as before.
Problem looks to be that it tries to use /.scss-lint.yml
instead of .scss-lint.yml
Sorry but I don't know that it could be happening, the plugin does't modify the options
If I run this code, it works without any problems:
But if I add this task as a dependency to another task like so:
I get an error because it can't find my config file.
I'm using scss-lint v0.29 and gulp-scss-lint v0.1.4. My config file is in the same location as my Gulpfile.