-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
107 lines (93 loc) · 3.12 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
95
96
97
98
99
100
101
102
103
104
105
106
107
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var cssnano = require('gulp-cssnano');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var svgmin = require('gulp-svgmin');
var order = require('gulp-order');
gulp.task('app_scripts_vendor', function() {
gulp.src(['static/app/src/js/pre-vendor/jquery-1.12.0.min.js', 'static/app/src/js/vendor/*.js'])
.pipe(order([
"/pre-vendor/jquery-1.12.0.min.js",
"/vendor/*.js"
], { base: './' }))
.pipe(concat('vendor.js'))
.pipe(uglify())
.pipe(gulp.dest('static/app/dist/js'));
});
gulp.task('app_scripts_custom', function() {
gulp.src(['static/app/src/js/custom/*.js'])
.pipe(concat('core.js'))
.pipe(uglify())
.pipe(gulp.dest('static/app/dist/js'));
});
gulp.task('landing_scripts', function() {
return gulp.src(['static/landing/src/js/*.js'])
.pipe(concat('core.js'))
.pipe(uglify())
.pipe(gulp.dest('static/landing/dist/js'));
});
gulp.task('app_styles', function() {
return gulp.src('static/app/src/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(cssnano())
.pipe(gulp.dest('static/app/dist/css/'));
});
gulp.task('landing_styles', function() {
return gulp.src('static/landing/src/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(cssnano())
.pipe(gulp.dest('static/landing/dist/css/'));
});
gulp.task('app_images', function() {
return gulp.src('static/app/src/img/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [
{removeViewBox: false},
{cleanupIDs: false}
],
use: [pngquant()]
}))
.pipe(gulp.dest('static/app/dist/img'));
});
gulp.task('landing_images', function() {
return gulp.src('static/landing/src/img/*')
.pipe(imagemin({
progressive: true,
svgoPlugins: [
{removeViewBox: false},
{cleanupIDs: false}
],
use: [pngquant()]
}))
.pipe(gulp.dest('static/landing/dist/img'));
});
gulp.task('app_svg', function () {
return gulp.src('static/app/src/inc/vectors/*.svg')
.pipe(svgmin())
.pipe(gulp.dest('static/app/dist/inc/vectors'));
});
gulp.task('landing_svg', function () {
return gulp.src('static/landing/src/inc/*.svg')
.pipe(svgmin())
.pipe(gulp.dest('static/landing/dist/inc'));
});
gulp.task('app_watch', function() {
gulp.watch(['static/app/src/scss/*.scss'], ['app_scripts', 'app_styles', 'app_images', 'app_svg'])
});
gulp.task('landing_watch', function() {
gulp.watch(['static/landing/src/scss/*.scss'], ['scripts', 'styles', 'images', 'svg'])
});
gulp.task('landing_fonts', function() {
return gulp.src('static/landing/src/scss/fonts/**/*.{ttf,woff,woff2,eof,svg}')
.pipe(gulp.dest('static/landing/dist/css/fonts'));
});
gulp.task('default', ['app_scripts_vendor', 'app_scripts_custom', 'landing_scripts', 'app_styles', 'landing_styles', 'app_images', 'landing_images', 'app_svg', 'landing_svg', 'app_watch', 'landing_watch', 'landing_fonts']);
gulp.on('stop', function () {
process.nextTick(function () {
process.exit(0);
});
});