This repository has been archived by the owner on Jan 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
/
gulpfile.js
94 lines (74 loc) · 2.18 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var sass = require('gulp-sass');
var image = require('gulp-image');
gulp.task('panel-js', function() {
return gulp.src(
[
'assets/js/src/plugins/*.js',
'assets/js/src/jquery/jquery.js',
'assets/js/src/jquery/plugins/*.js',
'assets/js/src/components/*.js'
])
.pipe(concat('panel.js'))
.pipe(gulp.dest('assets/js/dist'))
.pipe(rename('panel.min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js/dist'));
});
gulp.task('app-js', function() {
return gulp.src('assets/js/src/app.js')
.pipe(gulp.dest('assets/js/dist'))
.pipe(rename('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js/dist'));
});
gulp.task('form-js', function() {
return gulp.src('app/fields/*/assets/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('form.js'))
.pipe(gulp.dest('assets/js/dist'))
.pipe(rename('form.min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js/dist'));
});
gulp.task('panel-css', function() {
return gulp.src('assets/scss/panel.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('assets/css'))
.pipe(rename('panel.min.css'))
.pipe(cssmin())
.pipe(gulp.dest('assets/css'));
});
gulp.task('form-css', function() {
return gulp.src('app/fields/*/assets/css/*.css')
.pipe(concat('form.css'))
.pipe(gulp.dest('assets/css'))
.pipe(rename('form.min.css'))
.pipe(cssmin())
.pipe(gulp.dest('assets/css'));
});
gulp.task('image', function() {
gulp.src('assets/images/*')
.pipe(image())
.pipe(gulp.dest('assets/images'));
});
gulp.task('watch', function() {
gulp.watch('assets/scss/**/*.scss', ['panel-css']);
gulp.watch('assets/js/src/**/*.js', ['panel-js', 'app-js']);
gulp.watch('app/fields/*/assets/js/*.js', ['form-js']);
gulp.watch('app/fields/*/assets/css/*.css', ['form-css']);
});
gulp.task('default', [
'panel-css',
'panel-js',
'app-js',
'form-js',
'form-css',
'image'
]);