Permalink
Browse files

Adds config override options to cli and gulp task

  • Loading branch information...
1 parent 628875d commit 819368c40785731acab5ae6fea63a9b028acf1e8 @el-mapache el-mapache committed May 31, 2016
Showing with 11 additions and 3 deletions.
  1. +5 −1 README.md
  2. +1 −1 bin/cli.js
  3. +5 −1 index.js
View
@@ -27,7 +27,11 @@ The stylelint function accepts two arguments:
```
{
syntax: Syntax the linter validates against. Valid options are `scss|css|less`. Defaults to scss
- ignore: A glob (or array of globs) of files the linter should ignore
+ ignore: A glob (or array of globs) of files the linter should ignore,
+ config: A path to a stylelint config file. File should use the same
+ conventions as the config file found in this repository, exporting a
+ single javascript object.
+
}
```
View
@@ -29,7 +29,7 @@ if (ignoredFiles) {
stylelint.lint({
files: files,
- config: lintConfig,
+ config: program.config || lintConfig,
configBasedir: path.join(__dirname, '../', './src'),
syntax: program.syntax || 'scss',
formatter: formatter
View
@@ -17,11 +17,15 @@ module.exports = function(files, options) {
lintConfig['ignoreFiles'] = options.ignore;
}
+ if (typeof options.config === 'string' && options.config) {
+ lintConfig = require(path.resolve(__dirname, options.config));
+ }
+
return function() {
return gulp
.src(files)
.pipe(gulpStylelint({
- config: require('./src/stylelint-config'),
+ config: lintConfig,
configBasedir: path.join(__dirname, './src'),
syntax: options.syntax || 'scss',
reporters: [

0 comments on commit 819368c

Please sign in to comment.