-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
55 lines (45 loc) · 1.31 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
const
gulp = require('gulp'),
util = require('gulp-util'),
concat = require('gulp-concat'),
ts = require('gulp-typescript'),
sass = require('gulp-sass'),
merge = require('merge2'),
replace = require('gulp-replace'),
gulpIf = require('gulp-if');
const release = !!(util.env.r || util.env.release);
if (release) {
util.log(`Running in ${util.colors.blue('RELEASE')} mode`);
}
const compiledModuleSeparator = `
})(ngSchedule || (ngSchedule = {}));
var ngSchedule;
(function (ngSchedule) {
`;
const tsProject = ts.createProject('tsconfig.json', {
typescript: require('typescript')
});
gulp.task('ts', function () {
const projectSrc = gulp.src([
'src/scripts/*.ts'])
.pipe(concat('ng-schedule.ts'));
const tsCompiled = merge([projectSrc, gulp.src(['typings/**/*.ts', 'src/definitions/**/*.d.ts'])])
.pipe(ts(tsProject));
return merge([
tsCompiled.js.pipe(replace(compiledModuleSeparator, '\n\n')),
tsCompiled.dts
])
.pipe(gulp.dest('build'))
.pipe(gulpIf(release, gulp.dest('./')));
});
gulp.task('sass', function () {
return gulp.src('src/styles/*.scss')
.pipe(sass())
.pipe(gulp.dest('build'))
.pipe(gulpIf(release, gulp.dest('./')));
});
gulp.task('default', ['ts', 'sass']);
gulp.task('watch', ['default'], function () {
gulp.watch('src/**/*.ts', ['ts']);
gulp.watch('src/**/*.scss', ['sass']);
});