-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
40 lines (35 loc) · 1014 Bytes
/
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
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
gulp.task('javascripts', () => {
gulp.src('src/js/app.es6')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('./js/'));
});
gulp.task('compress', () => {
gulp.src('js/app.js')
.pipe(uglify())
.pipe(gulp.dest('./js/'));
});
gulp.task('styles', () => {
gulp.src('src/scss/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer('last 2 versions'))
.pipe(gulp.dest('./css/'));
});
gulp.task('minify-css', () => {
gulp.src('css/*.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('./css/'));
});
gulp.task('default',() => {
gulp.watch('src/scss/**/*.scss',['styles']);
gulp.watch('css/main.css',['minify-css']);
gulp.watch('src/js/app.es6',['javascripts']);
gulp.watch('js/app.js',['compress']);
});