Gathering detailed insights and metrics for gulp-sass-lint-build
Gathering detailed insights and metrics for gulp-sass-lint-build
npm install gulp-sass-lint-build
Typescript
Module System
Node Version
NPM Version
Total Downloads
1,434
Last Day
4
Last Week
8
Last Month
18
Last Year
99
Minified
Minified + Gzipped
Latest Version
1.1.0
Package Id
gulp-sass-lint-build@1.1.0
Size
8.35 kB
NPM Version
3.9.0
Node Version
6.1.0
Cumulative downloads
Total Downloads
Last day
0%
4
Compared to previous day
Last week
33.3%
8
Compared to previous week
Last month
260%
18
Compared to previous month
Last year
-29.8%
99
Compared to previous year
npm install gulp-sass-lint-build --save-dev
gulpfile.js
1'use strict'; 2 3var gulp = require('gulp'), 4 sassLint = require('gulp-sass-lint'); 5 6gulp.task('default', function () { 7 return gulp.src('sass/**/*.s+(a|c)ss') 8 .pipe(sassLint()) 9 .pipe(sassLint.format()) 10 .pipe(sassLint.failOnError()) 11});
You can pass an object of options to configure gulp-sass-lint to your specific projects needs the options are listed below.
You can find out more about the specific SassLint options from the SassLint Documentation
1{ 2 options: { 3 'merge-default-rules': false, 4 } 5}
By default SassLint includes it's own configuration file, if you provide one it attempts to merge everything except for the files section below. If you pass options directly into the plugin they take precedence. The order can be visualised below with the SassLint config being the base.
options > config file > SassLint default included config
You can disable this behaviour by setting merge-default-rules
to false within the options.options
object that you pass to gulp-sass-lint
or you can include it in your config file options that you can pass into gulp-sass-lint
with options.configFile
.
More info and examples can be found within the SassLint docs
Type: Object
Within the files object you can specify a glob pattern as a string or an array of glob pattern for both the include
and ignore
options. Please note that your include option will currently be ignored as you should be passing the glob patterns / file paths to be linted directly to gulp gulp.src('sass/**/*.s+(a|c)ss')
. The ignore option however will still be respected if you'd rather specify them in your config rather than in the gulp.src
method.
1{ 2 files: { 3 include: '**/*.scss', // This will be ignored by gulp-sass-lint 4 ignore: 'test/**/*.scss' // This will still be respected and read 5 } 6}
Type: Object
You can define which rules you would like to use here and set a severity too. For more information see how to configure and also the SassLint rules
1{ 2 rules: { 3 'no-ids': 0, // Severity 0 (disabled) 4 'no-mergeable-selectors': 1, // Severity 1 (warning) 5 'hex-length': [ 6 2, // Severity 2 (error) 7 { 8 'style': 'long' 9 } 10 ] 11 } 12}
You can pass the path to a custom config file via the configFile
option. The path will be relative to where you're running gulp from.
1{ 2 configFile: 'app/config/.my-config.yml' 3}
The following highlights all of the above options in use
1 2'use strict'; 3 4var gulp = require('gulp'), 5 sassLint = require('gulp-sass-lint'); 6 7gulp.task('default', function () { 8 return gulp.src('sass/**/*.s+(a|c)ss') 9 .pipe(sassLint({ 10 options: { 11 'merge-default-rules': false 12 }, 13 files: {ignore: '**/*.scss'}, 14 rules: { 15 'no-ids': 1, 16 'no-mergeable-selectors': 0 17 }, 18 configFile: 'config/other/.sass-lint.yml' 19 })) 20 .pipe(sassLint.format()) 21 .pipe(sassLint.failOnError()) 22}); 23
Formats the results dependent on your config file or the options you provided to the sassLint task above. The default format is stylish
but you can choose any of the others that SassLint provides, see the docs. You can also choose to output to a file from within the options you provide or your config file. See the output-file docs
By default it created two files to report the error (HTML and JSON) in the project root.
Define directory base for create files report.
1 .pipe(sassLint.format( 2 { 3 base: config.paths.reportFolder 4 } 5 ));
1 .pipe(sassLint.format( 2 { 3 output: [ 4 { 5 // Console report 6 formatter: 'stylish' 7 }, 8 { 9 formatter: 'html', 10 'output-file': './reports/sass-lint.html' 11 }, 12 { 13 formatter: 'json', 14 'output-file': './reports/sass-lint.json' 15 } 16 ] 17 } 18 ));
Fails the task and emits a gulp error when all files have been linted if an error has been detected (rules set to severity 2).
No vulnerabilities found.
No security vulnerabilities found.