-
Notifications
You must be signed in to change notification settings - Fork 25
/
gulpfile-old.js
executable file
·138 lines (125 loc) · 2.88 KB
/
gulpfile-old.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
134
135
136
137
138
/* jshint node:true */
'use strict';
var gulp = require('gulp'),
webserver = require('gulp-webserver'),
livereload = require('gulp-livereload'),
fileinclude = require('gulp-file-include'),
autoprefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
cssnano = require('gulp-cssnano'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
iconfont = require('gulp-iconfont'),
watch = require('gulp-watch');
// Definitions
var source = {
js: [
'assets/js/typed.js',
'assets/js/glider.min.js',
'assets/js/script.js',
],
};
// Tasks
// Webserver
gulp.task('webserver', function () {
gulp.src('./').pipe(
webserver({
open: '/build',
livereload: true,
directoryListing: true,
fallback: 'index.html',
}),
);
});
// File include
gulp.task('fileinclude', function () {
gulp
.src(['html-dev/*.html'])
.pipe(
fileinclude({
prefix: '@@',
basepath: 'html-dev/',
}),
)
.pipe(gulp.dest('build'))
.pipe(livereload({ start: true }));
});
// Styles
gulp.task('sass', function () {
gulp
.src('assets/scss/style.scss')
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(
autoprefixer({
overrideBrowserslist: ['last 10 versions'],
cascade: false,
}),
)
.pipe(gulp.dest('build/assets/css'))
.pipe(livereload({ start: true }));
});
// Scripts
gulp.task('scripts', function () {
gulp
.src(source.js)
.pipe(concat('scripts.min.js'))
// .pipe(uglify())
.pipe(gulp.dest('build/assets/js'))
.pipe(livereload({ start: true }));
});
// Fonts
gulp.task('fonts', function () {
return gulp.src('assets/fonts/*').pipe(gulp.dest('build/assets/fonts'));
});
// Iconfont
gulp.task('Iconfont', function () {
return gulp
.src(['assets/img/icons/*.svg'])
.pipe(
iconfont({
fontName: 'iconFont',
prependUnicode: true,
formats: ['ttf', 'eot', 'woff', 'svg'],
normalize: true,
fontWeight: '300',
fontHeight: 100,
fixedWidth: false,
centerHorizontally: false,
}),
)
.pipe(gulp.dest('build/assets/fonts/'));
});
// images
gulp.task('images', function () {
return gulp.src('assets/img/**/*').pipe(gulp.dest('build/assets/img/'));
});
// Watch
gulp.task('watch', function () {
gulp.watch(['assets/scss/*.scss'], ['sass']);
gulp.watch(['assets/js/*.js'], ['scripts']);
gulp.watch(['assets/img/icons/*.svg'], ['Iconfont']);
gulp.watch(['html-dev/**/*.html'], ['fileinclude']);
gulp.watch(['assets/fonts/*.*'], ['fonts']);
gulp.watch(['assets/img/**/*'], ['images']);
});
// Default task
gulp.task('default', [
'sass',
'scripts',
'Iconfont',
'fonts',
'fileinclude',
'images',
'webserver',
'watch',
]);
/*
.gitignore
.idea
node_modules/
.DS_Store
.ftpconfig
build/
.vscode/
*/