Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CSS and LESS files by default #8 #9

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 @@ -54,7 +54,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 @@ -39,6 +39,6 @@ function buildOptions(options) {
}, options, {
// Default Glob is any directory level of scss and/or sass file,
// under webpack's context and specificity changed via globbing patterns
files: arrify(options.files || '**/*.s?(c|a)ss')
files: arrify(options.files || '**/*.{c,sc,sa,le}ss')
});
}
3 changes: 3 additions & 0 deletions test/fixtures/test8/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require(getPath('./../../../node_modules/file-loader/index') + '!./test.css!./test.scss!./test.sass!./test.less');

console.log('test8');
3 changes: 3 additions & 0 deletions test/fixtures/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/fixtures/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/fixtures/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/fixtures/test8/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
}
14 changes: 14 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ describe('sasslint-loader', function () {
});
});

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

pack(assign({}, baseConfig, config), function (err, stats) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method's been updated to return a promise which makes writing these tests a bit easier :) (#27)

return pack(/* config */)
  .then(function (stats) {
    //asserts on stats
  });

expect(err).to.not.exist;
expect(stats.compilation.errors.length).to.equal(4);
expect(stats.compilation.warnings.length).to.equal(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the .to.have.length assertion on the errors and warnings arrays, because they provide better messages when failing.

done(err);
});
});

// it('should work with multiple context', function(done) {
// var config = {
// context: './test/fixtures/test5',
Expand Down