forked from raphaelfabeni/css-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (48 loc) · 1.38 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
var sassLint = require('gulp-sass-lint');
var notify = require('gulp-notify');
gulp.task('serve', ['sass'], function() {
browserSync.init({
server: './',
open: false
});
gulp.watch(['src/*.sass', 'src/**/*.sass'], ['sass']);
gulp.watch('examples/*.html').on('change', browserSync.reload);
});
gulp.task('lint', function () {
return gulp.src('src/**/*.s+(a|c)ss')
.pipe(sassLint({
config: '.sass-lint.yml'
}))
.pipe(sassLint.format())
.pipe(sassLint.failOnError())
});
gulp.task('sass', function() {
return gulp.src('src/css-loader.sass')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded',
noCache: true
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
gulp.task('build', ['sass'], function() {
return gulp.src('src/css-loader.sass')
.pipe(sass({
outputStyle: 'compressed',
noCache: true
}))
.pipe(gulp.dest('dist'))
.pipe(notify({
title: 'Build task completed! <o/',
message: 'CSS file created in => dist/css-loader.css',
onLast: true
}))
});
gulp.task('default', ['serve']);