-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (30 loc) · 1.15 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
const gulp = require('gulp');
const ngTemplates = require('gulp-ng-templates');
const fs = require('fs');
gulp.task('html:templates', function () {
gulp.src('src/**/*.html')
.pipe(ngTemplates({
filename: 'cc-templates.js',
module: 'cc-templates',
path: function (path, base) {
return path.replace(base, 'src/');
}
}))
.pipe(gulp.dest('dist'));
});
gulp.task('build', function () {
const templates = fs.readFileSync('./dist/cc-templates.js');
const build = fs.readFileSync('./dist/build.js');
const html1 = '<!DOCTYPE html><html' +
' xmlns="http://www.w3.org/1999/xhtml"><head><meta' +
' charset="UTF-8"><base href="/"><title>Gitlab' +
' Build Monitor</title>';
const html2 = '</head><body ng-app="gitlab-monitor"><app></app></body></html>';
const target = './dist/index.html';
fs.writeFileSync(target, html1);
fs.appendFileSync(target, "\n<script>\n");
fs.appendFileSync(target, build);
fs.appendFileSync(target, templates);
fs.appendFileSync(target, "\n</script>\n");
fs.appendFileSync(target, html2);
});