stylelintとは?
-lint工程を追加することで、コードを綺麗にし、保守性を高める
-styleの重複を減らす
csslintとは?
$ npm install -g csslint
$ csslint main.css
sasslintを導入
$ npm install gulp-sass-lint –save-dev
$ gulp
var sassLint = require('gulp-sass-lint'); gulp.task('sass', function(done){ gulp.src('./src/sass/*.scss') .pipe(plumber()) .pipe(sassLint()) .pipe(sassLint.format()) .pipe(sassLint.failOnError()) .pipe(sass({outputStyle: 'expand'})) .pipe(gulp.dest('./dest/css')) done(); });
src/sass/main.scss
2:2 warning Mixed tabs and spaces indentation
2:20 warning Color ‘red’ should be written in its hexadecimal form #ff0000 no-color-keywords
2:20 warning Color literals such as ‘red’ should only be used in variable declarations no-color-literals
3:2 warning Mixed tabs and spaces indentation
4:2 warning Mixed tabs and spaces indentation
5:1 warning Files must end with a new line final-newline
✖ 6 problems (0 errors, 6 warnings)
ああああああ、これスゲー