-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
68 lines (57 loc) · 1.84 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
60
61
62
63
64
65
66
67
68
'use strict';
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var cleanCss = require('gulp-clean-css');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
gulp.task('compile-sass', function () {
return gulp.src('assets/scss/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
overrideBrowserslist: ['last 10 versions'],
cascade: false
}))
.pipe(gulp.dest('assets/css'));
});
gulp.task('pack-css', function () {
return gulp.src([
'assets/css/vendors/jquery-ui.css',
'assets/css/main.css',
])
.pipe(concat('bundle.css'))
.pipe(gulp.dest('public/build/css'));
});
gulp.task('minify-css', function () {
return gulp.src([
'public/build/css/bundle.css'
])
.pipe(concat('bundle.min.css'))
.pipe(cleanCss())
.pipe(gulp.dest('public/build/css'))
});
gulp.task('pack-js', function () {
return gulp.src([
'assets/js/vendors/jquery.js',
'assets/js/vendors/jquery-ui.js',
'assets/js/iframeResizer.contentWindow.min.js',
'assets/js/main.js',
])
.pipe(concat('bundle.js'))
.pipe(gulp.dest('public/build/js'));
});
gulp.task('minify-js', function () {
return gulp.src([
'public/build/js/bundle.js'
])
.pipe(concat('bundle.min.js'))
.pipe(uglify())
.pipe(gulp.dest('public/build/js'))
});
gulp.task('make-css', gulp.series('compile-sass', 'pack-css', 'minify-css'));
gulp.task('make-js', gulp.series('pack-js', 'minify-js'))
gulp.task('default', gulp.series('make-css', 'make-js'))
gulp.task('watch', function () {
gulp.watch('assets/scss/**/*.scss', gulp.series('make-css'));
gulp.watch('assets/js/**/*.js', gulp.series('make-js'));
});