-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
98 lines (89 loc) · 3.15 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
'use strict';
var gulp = require('gulp'),
browserSync = require('browser-sync'),
watch = require('gulp-watch'),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
refresh = require('gulp-livereload'),
concat = require('gulp-concat'),
jscpd = require('gulp-jscpd'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
rename = require('gulp-rename'),
del = require('del'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
cache = require('gulp-cache');
gulp.task('browser-sync', function() {
browserSync({
server: {
baseDir: 'app'
},
notify: false
});
});
gulp.task('js', function() {
return gulp.src([
'node_modules/jquery/dist/jquery.min.js',
'node_modules/owl.carousel/dist/owl.carousel.min.js',
'node_modules/mediaelement/build/mediaelementplayer.min.js',
'node_modules/mediaelement/build/lang/ru.js',
'node_modules/social-buttons/src/js/*.js',
'node_modules/jquery-sticky/jquery.sticky.js',
'node_modules/jquery-plugin-viewport-checker/dist/jquery.viewportchecker.min.js',
'node_modules/css-element-queries/src/ResizeSensor.js',
'app/js/jquery.validate.js',
'app/js/messages_ru.js',
'app/js/amazingslider.js',
'app/js/froogaloop2.min.js',
'app/js/initslider-1.js',
'app/js/main.js',
'app/js/animationOnStart.js',
'app/js/validateForm.js'
])
.on('error', console.log)
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(jscpd())
.pipe(gulp.dest('app/dist'));
});
gulp.task('css', function() {
return gulp.src([
'node_modules/mediaelement/build/mediaelementplayer.min.css',
'node_modules/owl.carousel/dist/assets/owl.carousel.min.css',
'node_modules/owl.carousel/dist/assets/owl.theme.default.min.css',
'node_modules/social-buttons/src/css/SocialButtons.css',
'node_modules/animate.css/animate.min.css',
'app/css/amazingslider-1.css',
'app/css/fonts.css',
'app/css/style.css',
'app/css/audio.css',
'app/css/media.css'
])
.on('error', console.log)
.pipe(concat('styles.min.css'))
.pipe(autoprefixer('last 5 version', 'ie 9', 'ie 10'))
.pipe(minifyCss())
.pipe(gulp.dest('app/dist'));
});
gulp.task('clean', function() {
return del.sync('app/dist');
});
gulp.task('clear', function() {
return cache.clearAll();
})
gulp.task('img', function() {
return gulp.src('app/img/**/*')
.pipe(cache(imagemin({
interlaced: true,
progressive: true,
svgoPlugins: [{ removeViewBox: false }],
use: [pngquant()]
})))
.pipe(gulp.dest('app/img'));
});
gulp.task('watch', ['js', 'css'], function () {
gulp.watch('app/js/*.js', ['js'])
gulp.watch('app/css/*.css', ['css'])
});
gulp.task('start', ['browser-sync', 'clean', 'img', 'css', 'js', 'watch']);