-
Notifications
You must be signed in to change notification settings - Fork 93
/
gulpfile.ts
81 lines (73 loc) · 1.81 KB
/
gulpfile.ts
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
import * as gulp from 'gulp';
import * as autoprefixer from 'gulp-autoprefixer';
import * as gulpSass from 'gulp-sass';
import * as dartSass from 'sass';
import * as sassGlob from 'gulp-sass-glob';
import * as template from 'gulp-template';
import * as jsonModify from 'gulp-json-modify';
import { join } from 'path';
import { argv } from 'yargs';
const sass = gulpSass(dartSass);
const AUTOPREFIXER_BROWSERS = [
'ie >= 11',
'ie_mob >= 11',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10',
];
// --------------
// Build SASS
gulp.task('build.sass', (done) => {
const app_cdn = argv['deployUrl'] ? argv['deployUrl'] : '';
gulp
.src(join(__dirname, 'src', 'stylesheets', 'main.scss'))
.pipe(
sassGlob({
ignorePaths: ['**/*.ng.scss'],
})
)
.pipe(
sass({
includePaths: [join(__dirname, 'src', 'stylesheets')],
style: 'compressed',
}).on('error', sass.logError)
)
.pipe(autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(
template({
APP_CDN: app_cdn,
})
)
.pipe(gulp.dest(join(__dirname, '.styles')))
.on('end', () => {
gulp
.src(join(__dirname, '.styles', 'main.css'))
.pipe(gulp.dest(join(__dirname, 'src')))
.on('end', done);
});
});
// --------------
// i18n
gulp.task('generate-ngsw-appData', () => {
return gulp
.src(join(__dirname, 'ngsw-config.json'))
.pipe(
jsonModify({
key: 'appData.commit',
value: `${process.env.CI_COMMIT_REF_NAME}-${process.env.CI_COMMIT_SHORT_SHA}`,
})
)
.pipe(gulp.dest('./'));
});
gulp.task(
'extract.i18n',
require(join(__dirname, 'tasks', 'extract.i18n.xlf'))(gulp)
);
gulp.task(
'import.i18n',
require(join(__dirname, 'tasks', 'import.i18n.xlf'))(gulp)
);