-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·59 lines (46 loc) · 1.29 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
55
56
57
58
59
"use strict";
/****************/
/* Load Plugins */
const gulp = require('gulp')
const util = require('gulp-util')
const rename = require('gulp-rename')
const sass = require('gulp-sass')
const autoprefixer = require('gulp-autoprefixer')
const cleancss = require('gulp-clean-css')
const uglify = require('gulp-uglify')
const babel = require('gulp-babel')
/*************/
/* Constants */
const src = './src_assets/'
const dist = './assets/'
/**********/
/* Tasks */
gulp.task('styles', () => {
return gulp.src(src + '**/*.scss')
.pipe(sass().on('error', util.log))
.pipe(autoprefixer({
browsers: ['> 1%', 'IE 9']
}).on('error', util.log))
.pipe(cleancss().on('error', util.log))
.pipe(rename({extname: ".min.css"}))
.pipe(gulp.dest(dist))
});
gulp.task('scripts', () => {
return gulp.src(src + '**/*.js')
.pipe(babel({
"presets": ['es2015']
}).on('error', util.log))
.pipe(uglify({
output: {
comments: /^!|@preserve|@license|@cc_on/i
}
}).on('error', util.log))
.pipe(rename({extname: ".min.js"}))
.pipe(gulp.dest(dist))
});
/**************************/
/* Watcher & Default Task */
gulp.task('watch', () => {
gulp.watch(src).on('change', gulp.parallel('styles', 'scripts'));
})
gulp.task('default', gulp.series(gulp.parallel('styles', 'scripts'), 'watch'));