forked from manywho/ui-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (46 loc) · 1.96 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
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var argv = require('yargs').argv;
var path = require('path');
var del = require('del');
function getTask(task) {
return require('./gulp-tasks/' + task)(gulp, plugins, argv);
}
// Hooks
gulp.task('pre-commit', getTask('hooks/pre-commit'));
// Dev
gulp.task('dev-less', getTask('dev/less'));
gulp.task('dev-ts', getTask('dev/ts'));
gulp.task('dev-bootstrap', getTask('dev/bootstrap'));
gulp.task('dev-bootstrap-themes', getTask('dev/bootstrap-themes'));
gulp.task('dev-fonts', function () {
return gulp.src('css/fonts/*.*').pipe(gulp.dest((argv.build || './build') + '/css/fonts'));
});
gulp.task('watch', ['dev-ts', 'dev-less', 'dev-bootstrap', 'dev-bootstrap-themes', 'dev-fonts'], function() {
gulp.watch(['css/*.less', '!css/mw-bootstrap.less'], ['dev-less']);
gulp.watch(['css/mw-bootstrap.less'], ['dev-bootstrap']);
gulp.watch(['css/themes/*.less'], ['dev-bootstrap-themes']);
gulp.watch(['js/**/*.*'], ['dev-ts']);
});
// Dist
gulp.task('dist-less', ['dist-clean'], getTask('dist/less'));
gulp.task('dist-bootstrap', ['dist-clean'], getTask('dist/bootstrap'));
gulp.task('dist-bootstrap-themes', ['dist-clean'], getTask('dist/bootstrap-themes'));
gulp.task('dist-ts', ['dist-clean'], getTask('dist/ts'));
gulp.task('dist-fonts', ['dist-clean'], function () {
return gulp.src('css/fonts/*.*').pipe(gulp.dest('./dist/css/fonts'));
});
gulp.task('dist-bundle', ['dist-ts', 'dist-less', 'dist-bootstrap', 'dist-bootstrap-themes', 'dist-fonts'], function() {
return gulp.src(['css/*.css', 'js/*.js'], { cwd: './dist' })
.pipe(plugins.filelist('bundle.json'))
.pipe(plugins.jsonEditor(resources => {
return {
'bootstrap3': resources.map(resource => '/' + resource)
}
}))
.pipe(gulp.dest('./dist'));
});
gulp.task('dist-clean', function() {
return del('./dist/**/*');
})
gulp.task('dist', ['dist-bundle']);