-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
133 lines (119 loc) · 3.54 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
'use strict';
var gulp = require ('gulp');
var path = require ('path');
var fs = require ('fs');
var $ = require ('gulp-load-plugins')();
var runSequence = require ('run-sequence');
var webserver = require ('gulp-webserver');
var merge = require ('merge-stream');
var del = require ('del');
var paths = {
html : './*.html',
koliseo : ['./js/koliseo-agenda.js', './js/koliseo-polyfill.js'],
fonts : [
'./font-awesome/fonts/*.*',
'./bootstrap/fonts/*.*'
],
css : [
'./bootstrap/css/bootstrap.min.css',
'./font-awesome/css/font-awesome.min.css',
'css/flexslider.css',
'css/owl.carousel.css',
'css/jquery-ui.min.css',
'css/style.css',
'css/kagenda-styles.css',
'css/custom.css',
'css/codigo-page.css'
],
code : [
'css/custom.css',
'css/codigo-page.css'
],
js : [
'./js/jquery.min.js',
'./bootstrap/./js/bootstrap.min.js',
'./js/jquery.easing.1.3.min.js',
'./js/jquery.backstretch.min.js',
'./js/jquery.flexslider-min.js',
'./js/owl.carousel.min.js',
'./js/masonry.pkgd.min.js',
'./js/jquery-ui.min.js',
'./js/pace.min.js',
'./js/wow.min.js',
'./js/jqBootstrapValidation.js',
'./js/custom.js',
'./js/jquery.countdown.min.js'
],
images : './img/**/*',
dist : './dist/'
};
gulp.task ('clean', function () {
return del ([
'./dist/**',
]);
});
gulp.task ('images', function () {
return gulp.src (paths.images)
.pipe ($.imagemin ({ progressive: true }))
.pipe (gulp.dest (paths.dist + '/img/'));
});
gulp.task ('js', function () {
return gulp.src (paths.js)
.pipe ($.concat ('main.js',{newLine: ';'}))
.pipe ($.uglify ())
.pipe (gulp.dest (paths.dist + '/js/'));
});
gulp.task ('koliseo', function () {
return gulp.src (paths.koliseo)
.pipe (gulp.dest (paths.dist + '/js/'));
});
gulp.task ('css', function () {
var page = gulp.src (paths.css)
.pipe ($.concat ('main.css'))
.pipe ($.cssmin ())
.pipe (gulp.dest (paths.dist + '/css/'));
var codePage = gulp.src (paths.code)
.pipe ($.concat ('main-conduct.css'))
.pipe ($.cssmin ())
.pipe (gulp.dest (paths.dist + '/css/'));
return merge(page, codePage);
});
gulp.task ('fonts', function () {
return gulp.src (paths.fonts)
.pipe (gulp.dest(paths.dist + '/fonts'));
});
gulp.task ('build', ['images', 'fonts', 'koliseo', 'js', 'css'], function () {
return gulp.src (['index.html', 'codigodeconducta.html'])
.pipe ($.useref ())
.pipe ($.minifyHtml ({
quotes : true,
empty : true,
spare : true
}))
.pipe(gulp.dest ('dist'))
});
gulp.task ('server', function () {
gulp.src ('.')
.pipe (webserver ({
port : 5000,
livereload : false,
directoryListing : {
enable : false,
},
open : 'index.html'
}));
});
gulp.task ('server:dist', ['dist'], function () {
gulp.src ('.')
.pipe (webserver ({
port : 5000,
livereload : false,
directoryListing : {
enable : false,
},
open : 'dist/index.html'
}));
});
gulp.task ('dist', function (cb) {
runSequence ('clean', 'build', cb);
})