-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
42 lines (36 loc) · 1.06 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
'use strict'
let gulp = require('gulp')
let sass = require('gulp-sass')
let rename = require('gulp-rename')
let sourcemaps = require('gulp-sourcemaps')
let autoprefixer = require('gulp-autoprefixer')
let removeEmptyLines = require('gulp-remove-empty-lines')
let vendors = { browsers: ['last 5 versions'] }
gulp.task('compress', () => {
return gulp.src('./src/gosp.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(autoprefixer(vendors))
.pipe(rename('gosp.min.css'))
.pipe(sourcemaps.write('.'))
.pipe(removeEmptyLines({
removeComments: true
}))
.pipe(gulp.dest('./dist'))
});
gulp.task('normal', () => {
return gulp.src('./src/gosp.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(autoprefixer(vendors))
.pipe(sourcemaps.write('.'))
.pipe(removeEmptyLines())
.pipe(gulp.dest('./dist'))
});
gulp.task('default', ['normal', 'compress'], () => {
gulp.watch('src/**/*.scss', ['normal', 'compress']);
})