-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (36 loc) · 1.01 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
var gulp = require('gulp');
var runSequence = require('run-sequence'); // sequence of tasks
var debug = require('gulp-debug'); // debug
var del = require('del'); // delete dist
var newer = require('gulp-newer'); // checks for file changes
var sass = require('gulp-sass'); // sass
var autoprefixer = require('gulp-autoprefixer'); // autoprefixer
// file locations
var src = 'src/';
var sassDir = src +'styles/**/*.scss';
var sassSrc = src + 'styles/index.scss';
var dist = './dist/';
var sassDist = dist + 'styles/';
// delete dist
gulp.task('clean', function() {
return del.sync('dist');
});
// sass
gulp.task('sass', function() {
gulp.src(sassSrc)
.pipe(sass({
errLogToConsole: true,
outputStyle: 'compressed'
}))
.on('error', function(err){
console.log(err.message);
})
.pipe(autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(gulp.dest(sassDist));
});
gulp.task('default', function(cb) {
runSequence('clean', ['sass'], cb);
gulp.watch(sassDir, ['sass']);
});