-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
49 lines (43 loc) · 1.46 KB
/
Copy pathgulpfile.js
File metadata and controls
49 lines (43 loc) · 1.46 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
'use strict';
var gulp = require('gulp');
var less = require('gulp-less');
var minifyCss = require('gulp-minify-css');
var watch = require('gulp-watch');
var logger = require('gulp-logger');
var filter = require('gulp-filter');
var ts = require('gulp-typescript');
var path = require('path');
gulp.task('default', ['less', 'typescript:watch']);
gulp.task('less', function () {
return gulp.src('static/less/**/*.less')
.pipe(watch('static/less/**/*.less'))
.pipe(less())
.pipe(minifyCss())
.pipe(gulp.dest('static/css'))
.pipe(logger({ beforeEach: 'less [wrote]: '}));
});
gulp.task('typescript', function () {
var tsResult = gulp.src('static/ts/**/*.ts')
.pipe(filter([ '*', '!static/ts/admin/**/*.ts' ]))
.pipe(ts({
target: 'ES5',
removeComments: true,
sortOutput: true,
out: 'main.js'
}));
return tsResult.js.pipe(gulp.dest('static/js'));
});
gulp.task('typescript:admin', function () {
var tsResult = gulp.src('static/ts/admin/**/*.ts')
.pipe(ts({
target: 'ES5',
removeComments: true,
sortOutput: true,
out: 'admin.js'
}));
return tsResult.js.pipe(gulp.dest('static/js'));
});
gulp.task('typescript:watch', function () {
gulp.watch('static/ts/*.ts', ['typescript']);
gulp.watch('./static/ts/admin/*.ts', ['typescript:admin']);
});