-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (49 loc) · 1.4 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
'use strict';
var gulp = require('gulp'),
watch = require('gulp-watch'),
prefixer = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
ts = require('gulp-typescript'),
sourcemaps = require('gulp-sourcemaps'),
cssmin = require('gulp-minify-css');
var paths = {
styles: {
app : 'app/**/*.scss',
main: 'assets/app.scss'
},
ts : 'app/**/*.ts'
};
gulp.task('watch', function () {
watch([paths.styles.app], function (event, cb) {
gulp.start('style:build');
});
watch([paths.styles.main], function (event, cb) {
gulp.start('app:style:build');
});
watch([paths.ts], function (event, cb) {
gulp.start('ts:build');
});
});
gulp.task('style:build', function () {
gulp.src(paths.styles.app, {base: "./"})
.pipe(sass())
.pipe(prefixer())
.pipe(cssmin())
.pipe(gulp.dest('.'));
});
gulp.task('app:style:build', function () {
gulp.src(paths.styles.main, {base: "./"})
.pipe(sass())
.pipe(prefixer())
.pipe(cssmin())
.pipe(gulp.dest('.'));
});
gulp.task('ts:build', function () {
var tsProject = ts.createProject('./tsconfig.json');
gulp.src(paths.ts)
.pipe(sourcemaps.init())
.pipe(ts(tsProject))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('app/'));
});
gulp.task('default', ['watch']);