-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
76 lines (63 loc) · 1.92 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
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
'use strict';
const gulp = require('gulp');
const del = require('del');
const runSequence = require('run-sequence');
const concat = require('gulp-concat');
const cleanCss = require('gulp-clean-css');
const exec = require('child_process').execSync;
const utilities = require('@renovolive/gulp-utilities');
utilities.gulp.clean.config();
utilities.gulp.version.config();
const testBundleSource = '(source/ui.module.js + karma-test-setup.js + source/**/*.tests.js)';
utilities.gulp.bundle.config('tests', testBundleSource, {
outDir: 'tests',
outFile: 'tests.bundle.js',
});
const scriptFiles = [
'./source/**/*.js',
'./source/**/*.html',
'./bootstrapper/**/*.js',
'./bootstrapper/**/*.html',
'./bootstrapper/*.js',
'./bootstrapper/*.html',
];
const otherFiles = ['./source/**/*.css', '!./source/**/*.tests.js'];
const cssFiles = ['./node_modules/ng-wig/dist/**/*.css', './libraries/**/*.css', './source/**/*.css', '!./source/**/*ng2.css'];
const appBundleSource = 'bootstrapper/app.js';
utilities.gulp.bundle.config('bootstrapper', appBundleSource, {
mainAppFiles: scriptFiles,
outDir: 'bootstrapper',
outFile: 'app.bundle.js',
});
gulp.task('bundle-all.watch', (done) => {
gulp.watch(scriptFiles.concat(otherFiles), ['bundle-all']);
});
gulp.task('bundle-all', (done) => {
runSequence('bundle-bootstrapper',
'bundle-css',
'bundle-css.minify',
done);
});
gulp.task('bundle-css.watch', (done) => {
gulp.watch(cssFiles, ['bundle.css']);
});
gulp.task('bundle-css', () => {
return gulp.src(cssFiles)
.pipe(concat('components.css'))
.pipe(gulp.dest('./dist'));
});
gulp.task('bundle-css.minify', () => {
return gulp.src(cssFiles)
.pipe(cleanCss())
.pipe(concat('components.min.css'))
.pipe(gulp.dest('./dist'));
});
gulp.task('wipe-npm', () => {
return del('node_modules');
});
gulp.task('run-update', () => {
return exec('npm run update');
});
gulp.task('wipe-npm-update', ['wipe-npm'], () => {
gulp.start('run-update');
});