-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
113 lines (93 loc) · 2.67 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
var
gulp = require('gulp'),
concat = require('gulp-concat'),
concatCss = require('gulp-concat-css'),
replace = require('gulp-replace'),
cleanCSS = require('gulp-clean-css'),
imagemin = require('gulp-imagemin'),
fileinclude = require('gulp-file-include'),
htmlmin = require ('gulp-htmlmin'),
uglify = require('gulp-uglify');
// --
// Соблюдаем последовательность подключения!
var scripts = [
// ------------------------ Библиотеки ------------------------
'./node_modules/underscore/underscore-min.js',
'./node_modules/backbone/backbone-min.js',
'./node_modules/jquery/dist/jquery.min.js',
'./src/js/pace-config.js',
'./node_modules/pace-js/pace.min.js',
'./node_modules/bootstrap/dist/js/bootstrap.min.js',
// ------------------------ Файлы приложения ------------------------
'./src/js/app/app.js',
'./src/js/app/router.js',
// Module Managers
'./src/js/app/moduleManagers/**/*.js',
// Components
'./src/js/app/components/**/*.js',
// Widgets
'./src/js/app/widgets/**/*.js',
// Views
'./src/js/app/views/**/*.js',
// Models
'./src/js/app/models/**/*.js',
// Controllers
'./src/js/app/controllers/**/*.js',
// Запуск приложения
'./src/js/app/autorun.js'
];
var css = [
'./node_modules/bootstrap/dist/css/bootstrap.min.css',
'./node_modules/pace-js/themes/red/pace-theme-minimal.css',
'./src/css/style.css'
];
var fonts = [
'./node_modules/bootstrap/dist/fonts/**/*'
];
var html = [
'./src/html_templates/index.html'
];
var imgs = [
'./imgs/**/*'
];
gulp.task('js', function() {
return gulp.src(scripts)
.pipe(uglify())
.pipe(concat('./bundle.js'))
.pipe(gulp.dest('./web/assets/js/'));
});
gulp.task('css', function () {
return gulp.src(css)
//.pipe(replace('../fonts/', 'assets/fonts/'))
.pipe(concatCss("./bundle.css"))
.pipe(cleanCSS({ level: 2 }))
.pipe(gulp.dest('./web/assets/css/'));
});
gulp.task('fonts', function () {
return gulp
.src(fonts)
.pipe(gulp.dest('./web/assets/fonts'));
});
gulp.task('html', function () {
return gulp.src(html)
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./web'));
});
/*
gulp.task('images', function () {
return gulp
.src(imgs)
.pipe(imagemin())
.pipe(gulp.dest('../uploads/images'));
});
*/
gulp.task('default', [
'js',
'css',
'fonts',
'html'
]);