Skip to content

Instantly share code, notes, and snippets.

@jacine
Created May 27, 2016 18:41
Show Gist options
  • Save jacine/82f89157598d7e66169087b3dac3df42 to your computer and use it in GitHub Desktop.
Save jacine/82f89157598d7e66169087b3dac3df42 to your computer and use it in GitHub Desktop.
Sass lint
options:
formatter: stylish
files:
include: '**/*.s+(a|c)ss'
# ignore:
rules:
# Extends
extends-before-mixins: 1
extends-before-declarations: 1
placeholder-in-extend: 1
# Mixins
mixins-before-declarations: 1
# Line Spacing
one-declaration-per-line: 1
empty-line-between-blocks: 0
single-line-per-selector: 0
# Disallows
no-color-keywords: 0
no-color-literals: 0
no-css-comments: 1
no-debug: 1
no-duplicate-properties: 1
no-empty-rulesets: 1
no-extends: 0
no-ids: 0
no-important: 0
no-invalid-hex: 1
no-mergeable-selectors: 1
no-misspelled-properties: 1
no-qualifying-elements: 0
no-trailing-zero: 1
no-transition-all: 1
no-url-protocols: 1
no-vendor-prefixes: 1
no-warn: 0
# Nesting
force-attribute-nesting: 0
force-element-nesting: 0
force-pseudo-nesting: 0
# Name Formats
function-name-format: 1
mixin-name-format: 1
placeholder-name-format: 1
variable-name-format: 1
# Style Guide
border-zero: 1
brace-style: 1
clean-import-paths: 0
empty-args: 1
hex-length: 1
hex-notation: 1
indentation: 1
leading-zero: 0
nesting-depth: 1
property-sort-order: 1
quotes: 1
shorthand-values: 0
url-quotes: 1
variable-for-property: 1
zero-unit: 1
# Inner Spacing
space-after-comma: 1
space-before-colon: 1
space-after-colon: 1
space-before-brace: 1
space-before-bang: 1
space-after-bang: 1
space-between-parens: 1
# Final Items
trailing-semicolon: 1
final-newline: 1
// Sass task
//------------------------------------------------------------------------------
gulp.task('sass', ['sass-lint'], function() {
var onError = function(err) {
notify.onError({
title: "Gulp",
subtitle: "Failure!",
message: "Error: <%= error.message %>",
sound: "Beep"
})(err);
this.emit('end');
};
gulp.src('css/**/*.scss')
.pipe(plumber({ errorHandler: onError }))
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'expanded' }).on('error', sass.logError))
.pipe(autoprefixer('last 2 versions', '> 1%', 'ie 9'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('../css'))
.pipe(browsersync.stream({ match: '**/*.css' }));
});
// Sass Lint task
//------------------------------------------------------------------------------
gulp.task('sass-lint', function() {
return gulp.src('css/**/*.scss')
.pipe(sasslint())
.pipe(sasslint.format())
.pipe(sasslint.failOnError())
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment