forked from m-lab/mlab-speedtest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
65 lines (53 loc) · 1.63 KB
/
gulpfile.js
File metadata and controls
65 lines (53 loc) · 1.63 KB
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
var gulp = require('gulp');
var inject = require('gulp-inject');
var gettext = require('gulp-angular-gettext');
function inject(cb) {
gulp.src('www/index.html')
.pipe(inject(gulp.src('www/translations/scripts/*.js', {read: false}), {relative: true, name: 'translations'}))
.pipe(gulp.dest('www'));
cb();
};
function translations(cb) {
return gulp.src('translations/languages/*.po')
.pipe(gettext.compile())
.pipe(gulp.dest('app/assets/translations/'));
cb();
};
function pot(cb) {
return gulp.src([
'app/measure/*.js',
'app/measure/*.html',
'app/index.html',
])
.pipe(gettext.extract('application.pot', {
// options to pass to angular-gettext-tools...
}))
.pipe(gulp.dest('translations/source'));
cb();
};
// Copy dependencies to ./public/libs/
function copy_libs(cb) {
// Copy all the libraries under @bower_components to libraries/.
gulp.src([
"./node_modules/@bower_components/**/*.**",
], {base: "./node_modules/@bower_components"})
.pipe(gulp.dest('./app/libraries'));
// Copy the @m-lab js files to libraries/.
gulp.src([
"./node_modules/@m-lab/ndt7/src/*.js",
"./node_modules/@m-lab/msak/dist/*.min.js",
])
.pipe(gulp.dest('./app/libraries'));
gulp.src([
"./node_modules/ua-device-detector/ua-device-detector.min.js",
"./node_modules/ng-device-detector/ng-device-detector.min.js",
"./node_modules/re-tree/re-tree.min.js",
])
.pipe(gulp.dest('./app/libraries'));
cb();
};
exports.translations = gulp.series(pot, translations);
exports.inject = gulp.series(translations, inject);
exports.copy_libs = copy_libs;
exports.pot = pot;
exports.default = copy_libs;