-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
97 lines (92 loc) · 2.58 KB
/
gulpfile.babel.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
import filesystem from 'fs';
import gulp from 'gulp';
import gulpBabel from 'gulp-babel';
import gulpConcat from 'gulp-concat';
import gulpInsert from 'gulp-insert';
import gulpReplace from 'gulp-replace';
import gulpSass from 'gulp-sass';
import gulpUmd from 'gulp-umd';
const buildDate = new Date();
const buildVersion = require('./package.json').version;
gulp.task('build', ['compile-js', 'compile-styles']);
gulp.task('watch', () => gulp.watch('./src/**/*', ['build']));
gulp.task(
'compile-js',
() => {
return gulp
.src(
[
'./src/gelato.js',
'./src/modules/Application.js',
'./src/modules/View.js',
'./src/modules/Cookies.js',
'./src/modules/Collection.js',
'./src/modules/Component.js',
'./src/modules/Dialog.js',
'./src/modules/Locale.js',
'./src/modules/Model.js',
'./src/modules/Page.js',
'./src/modules/Router.js',
'./src/modules/Storage.js'
]
)
.pipe(gulpBabel({presets: ['latest']}))
.pipe(gulpConcat('backbone-gelato.js'))
.pipe(gulpUmd({
namespace: function() {
return 'Gelato';
},
exports: function() {
return 'Gelato';
},
dependencies: function() {
return [
{
name: 'jquery',
amd: 'jquery',
cjs: 'jquery',
global: '$',
param: '$'
},
{
name: 'lodash',
amd: 'lodash',
cjs: 'lodash',
global: '_',
param: '_'
},
{
name: 'backbone',
amd: 'backbone',
cjs: 'backbone',
global: 'Backbone',
param: 'Backbone'
}
];
}
}))
.pipe(gulpInsert.prepend(filesystem.readFileSync('./src/header.js')))
.pipe(gulpReplace('{!date!}', buildDate))
.pipe(gulpReplace('{!version!}', buildVersion))
.pipe(gulp.dest('./dist'));
}
);
gulp.task(
'compile-styles', () => {
return gulp
.src(
[
'./src/styles/application.scss',
'./src/styles/component.scss',
'./src/styles/dialog.scss',
'./src/styles/page.scss'
]
)
.pipe(gulpSass())
.pipe(gulpConcat('backbone-gelato.css'))
.pipe(gulpInsert.prepend(filesystem.readFileSync('./src/header.js')))
.pipe(gulpReplace('{!date!}', buildDate))
.pipe(gulpReplace('{!version!}', buildVersion))
.pipe(gulp.dest('./dist'));
}
);