File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ const PluginError = require('plugin-error');
4
4
const Lesshint = require ( 'lesshint' ) . Lesshint ;
5
5
const through = require ( 'through2' ) ;
6
6
7
+ const { isExcluded } = require ( './utils' ) ;
8
+
7
9
const lesshintPlugin = ( options = { } ) => {
8
10
const lesshint = new Lesshint ( ) ;
9
11
const config = lesshint . getConfig ( options . configPath ) ;
@@ -23,7 +25,7 @@ const lesshintPlugin = (options = {}) => {
23
25
return cb ( new PluginError ( 'gulp-lesshint' , 'Streaming not supported' ) ) ;
24
26
}
25
27
26
- if ( file . isNull ( ) || lesshint . isExcluded ( file . path ) ) {
28
+ if ( file . isNull ( ) || isExcluded ( config , file . path ) ) {
27
29
return cb ( null , file ) ;
28
30
}
29
31
Original file line number Diff line number Diff line change 27
27
" index.js"
28
28
],
29
29
"dependencies" : {
30
- "lesshint" : " ^5.0 .0" ,
30
+ "lesshint" : " ^5.1 .0" ,
31
31
"lesshint-reporter-stylish" : " ^3.0.0" ,
32
+ "minimatch" : " ^3.0.4" ,
32
33
"plugin-error" : " ^1.0.0" ,
33
34
"through2" : " ^2.0.0"
34
35
},
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const minimatch = require ( 'minimatch' ) ;
4
+
5
+ module . exports = {
6
+ isExcluded ( config , checkPath ) {
7
+ const excludedFiles = config && config . excludedFiles || [ ] ;
8
+
9
+ return excludedFiles . some ( ( pattern ) => {
10
+ return minimatch ( checkPath , pattern , {
11
+ matchBase : true ,
12
+ } ) ;
13
+ } ) ;
14
+ } ,
15
+ } ;
You can’t perform that action at this time.
0 commit comments