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 2 commits
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 @@ -19,7 +19,7 @@ function apply(options, compiler) {
}, 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').map(function (file) {
files: arrify(options.files || '**/*.{c,sc,sa,le}ss').map(function (file) {
return path.join(context, '/', file);
}),
context: context
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/test9/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('test9');
3 changes: 3 additions & 0 deletions test/fixtures/test9/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/test9/test.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's try a LESS-specific feature/syntax here?

}
3 changes: 3 additions & 0 deletions test/fixtures/test9/test.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you try using sass specific syntax here?

foo
}
3 changes: 3 additions & 0 deletions test/fixtures/test9/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
foo
}
13 changes: 13 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,17 @@ describe('stylelint-webpack-plugin', function () {
expect(stats.compilation.warnings).to.have.length(1);
});
});

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

return pack(assign({}, baseConfig, config))
.then(function (stats) {
expect(stats.compilation.errors).to.have.length(4);
expect(stats.compilation.warnings).to.have.length(4);
});
});
});