blob: efd2cca83e1843f3348c444cfa40af2b6de9b7f4 [file] [log] [blame]
Matteo Scandolod819c922016-12-02 14:06:14 -08001const path = require('path');
2
3const gulp = require('gulp');
4const del = require('del');
5const filter = require('gulp-filter');
Matteo Scandolo43ffb672016-12-02 14:49:58 -08006const rename = require("gulp-rename");
Matteo Scandolod819c922016-12-02 14:06:14 -08007
8const conf = require('../conf/gulp.conf');
Matteo Scandolo43ffb672016-12-02 14:49:58 -08009const cfgFolder = path.join(conf.paths.src, 'app/config');
Matteo Scandolod819c922016-12-02 14:06:14 -080010
11gulp.task('clean', clean);
12gulp.task('other', other);
Matteo Scandolo43ffb672016-12-02 14:49:58 -080013gulp.task('brand', styleConfig);
14gulp.task('appConfig', appConfig);
15gulp.task('config', gulp.series('brand', 'appConfig'));
Matteo Scandolod819c922016-12-02 14:06:14 -080016
17function clean() {
18 return del([conf.paths.dist, conf.paths.tmp]);
19}
20
Matteo Scandolo43ffb672016-12-02 14:49:58 -080021function appConfig() {
22 const env = process.env.NODE_ENV || 'production';
23 return gulp.src([
24 path.join(conf.paths.appConfig, `app.config.${env}.ts`)
25 ])
26 .pipe(rename('app.config.ts'))
27 .pipe(gulp.dest(cfgFolder));
28}
29
30function styleConfig() {
31 const env = process.env.BRAND || 'cord';
32 return gulp.src([
33 path.join(conf.paths.appConfig, `style.config.${env}.ts`)
34 ])
35 .pipe(rename('style.config.ts'))
36 .pipe(gulp.dest(cfgFolder));
37}
38
Matteo Scandolod819c922016-12-02 14:06:14 -080039function other() {
40 const fileFilter = filter(file => file.stat.isFile());
41
42 return gulp.src([
43 path.join(conf.paths.src, '/**/*'),
44 path.join(`!${conf.paths.src}`, '/**/*.{scss,ts,html}')
45 ])
46 .pipe(fileFilter)
47 .pipe(gulp.dest(conf.paths.dist));
48}