Skip to content

Commit

Permalink
Add support for CSS and LESS files by default webpack-contrib#8
Browse files Browse the repository at this point in the history
  • Loading branch information
VovanR committed Jun 17, 2016
1 parent a47b9cb commit 748de0b
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ See [stylelint options](http://stylelint.io/user-guide/node-api/#options), for t

* `configFile`: You can change the config file location. Default: (`.stylelintrc`)
* `context`: String indicating the root of your SCSS files. Default inherits from webpack config.
* `files`: Change the glob pattern for finding files. Default: (`['**/*.s?(a|c)ss']`)
* `files`: Change the glob pattern for finding files. Default: (`['**/*.{c,sc,sa,le}ss']`)
* `syntax`: Use `'scss'` to lint .scss files. Default (`undefined`)
* `formatter`: Use a custom formatter to print errors to the console. Default: (`require('stylelint/dist/formatters/stringFormatter').default`)
* `failOnError`: Have Webpack's build process die on error. Default: `false`
Expand All @@ -50,7 +50,7 @@ module.exports = {
new styleLintPlugin({
configFile: '.stylelintrc',
context: 'inherits from webpack',
files: '**/*.s?(a|c)ss',
files: '**/*.{c,sc,sa,le}ss',
failOnError: false,
})
]
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = function(options) {
options = options || {};
// Default Glob is any directory level of scss and/or sass file,
// under webpack's context and specificity changed via globbing patterns
options.files = options.files || '**/*.s?(c|a)ss';
options.files = options.files || '**/*.{c,sc,sa,le}ss';
!Array.isArray(options.files) && (options.files = [options.files]);
options.configFile = options.configFile || '.stylelintrc';
options.formatter = options.formatter || formatter;
Expand Down
14 changes: 14 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ describe('sasslint-loader', function () {
});
});

it('works with CSS, SCSS, SASS and LESS files by default', function (done) {
var config = {
context: './test/testfiles/test8',
entry: './index'
};

pack(assign({}, baseConfig, config), function (err, stats) {
expect(err).to.not.exist;
expect(stats.compilation.errors.length).to.equal(4);
expect(stats.compilation.warnings.length).to.equal(0);
done(err);
});
});

// it('should work with multiple context', function(done) {
// var config = {
// context: './test/testfiles/test5',
Expand Down
3 changes: 3 additions & 0 deletions test/testfiles/test8/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require(path.join(__dirname, './../../../node_modules/file-loader/index') + '!./test.css!./test.scss!./test.sass');

console.log('test8');
3 changes: 3 additions & 0 deletions test/testfiles/test8/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
}
3 changes: 3 additions & 0 deletions test/testfiles/test8/test.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
}
3 changes: 3 additions & 0 deletions test/testfiles/test8/test.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
}
3 changes: 3 additions & 0 deletions test/testfiles/test8/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
}

0 comments on commit 748de0b

Please sign in to comment.