-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (62 loc) · 1.59 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
const {src, dest, series} = require('gulp'),
sass = require('gulp-sass'),
through2 = require('through2'),
gitVersion = require('@kukjevov/gulp-git-version');
function logCopied()
{
return through2.obj(function(vinyl, _enc, callback)
{
console.log("Copying follow file: '" + vinyl.path + "'");
this.push(vinyl);
callback();
});
}
function copyConfig()
{
return src("config/i18n/**/*.json")
.pipe(logCopied())
.pipe(dest("wwwroot/config/i18n"));
}
function compileScss()
{
return src('content/*.scss')
.pipe(sass())
.pipe(dest('wwwroot/content'));
};
function copyFavicon()
{
return src("favicon.ico")
.pipe(logCopied())
.pipe(dest("wwwroot"));
}
function prepareVersion(cb)
{
gitVersion(
{
path: "config",
filename: "version.json",
currentVersionRegex: '"version": "(.*?)"',
template:
`{
"version": "{{version}}"
}`,
extractorOptions:
{
buildNumber: -1,
tagPrefix: "v",
ignoreBranchPrefix: "[a-z]+/|(?:[a-z]+-)+\\d+/",
pre: true,
suffix: "beta"
}
}, cb);
};
const build = series(copyConfig,
copyFavicon,
prepareVersion,
function buildComplete(cb)
{
console.log("Gulp build has finished");
cb();
});
exports.build = build;
exports.compileScss = compileScss;