-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathgulpfile.ts
More file actions
73 lines (64 loc) · 1.71 KB
/
gulpfile.ts
File metadata and controls
73 lines (64 loc) · 1.71 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
66
67
68
69
70
71
72
73
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const gulpSass = require('gulp-sass');
const dartSass = require('sass');
const sassGlob = require('gulp-sass-glob');
const template = require('gulp-template');
const { join } = require('path');
const yargs = require('yargs');
const { hideBin } = require('yargs/helpers');
const argv = yargs(hideBin(process.argv)).argv;
const sass = gulpSass(dartSass);
// const __dirname = './';
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('extract.i18n', async function () {
const mod = await import(join(__dirname, 'tasks', 'extract.i18n.xlf'));
return mod.default(gulp);
});
gulp.task('import.i18n', async function () {
const mod = await import(join(__dirname, 'tasks', 'import.i18n.xlf'));
return mod.default(gulp);
});