-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
122 lines (116 loc) · 2.7 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
const
gulp = require('gulp'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
concat = require('gulp-concat'),
connect = require('gulp-connect-php'),
browserSync = require('browser-sync'),
autoprefixer = require('autoprefixer'),
postcss = require('gulp-postcss'),
cssnano = require('cssnano'),
htmlmin = require('gulp-htmlmin')
;
function javascript() {
return gulp.src([
'node_modules/gsap/dist/gsap.min.js',
'node_modules/gsap/dist/ScrollTrigger.min.js',
'node_modules/gsap/dist/ScrollToPlugin.min.js',
'js/src/helpers/helper.js',
'js/src/helpers/scroll.js',
'js/src/helpers/animate.js',
'js/src/helpers/api.js',
'js/src/app/replurk.js',
'js/src/main.js'
])
.pipe(sourcemaps.init({
largeFile: true,
loadMaps: true
}))
.pipe(uglify())
.pipe(concat("bundle.js"))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest('js/'))
.pipe(browserSync.stream())
;
}
function css() {
return gulp.src([
'node_modules/normalize.css/normalize.css',
'css/src/main.css',
'css/src/404.css',
'css/src/nojs.css',
'css/src/print.css'
])
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(postcss([
autoprefixer(),
cssnano()
]))
.pipe(concat("bundle.css"))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest('css'))
.pipe(browserSync.stream())
;
}
function css_vertical() {
return gulp.src([
'css/src/vertical-screen.css'
])
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(postcss([
autoprefixer(),
cssnano()
]))
.pipe(concat("vertical-screen.css"))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest('css'))
.pipe(browserSync.stream())
;
}
function css_horizontal() {
return gulp.src([
'css/src/horizontal-screen.css'
])
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(postcss([
autoprefixer(),
cssnano()
]))
.pipe(concat("horizontal-screen.css"))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest('css'))
.pipe(browserSync.stream())
;
}
function php() {
return gulp.src(['src/*.php'])
.pipe(htmlmin({
collapseWhitespace: true
}))
.pipe(gulp.dest('./'))
.pipe(browserSync.stream())
}
exports.default = function() {
connect.server({
hostname: "0.0.0.0",
port: 8080,
base: "./",
keepalive: true
}, function () {
browserSync.init({
open: true,
proxy: "localhost:8080/"
});
});
gulp.watch(['js/src/*.js', 'js/src/*/*.js'], { ignoreInitial: false }, javascript);
gulp.watch(['css/src/*.css', 'css/src/*/*.css'], { ignoreInitial: false }, css);
gulp.watch('css/src/vertical-screen.css', { ignoreInitial: false }, css_vertical);
gulp.watch('css/src/horizontal-screen.css', { ignoreInitial: false }, css_horizontal);
gulp.watch('src/*.php', { ignoreInitial: false }, php);
};