-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (53 loc) · 1.46 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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var cssnano = require('gulp-cssnano');
var shell = require('gulp-shell');
var ts = require('gulp-typescript');
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function () {
browserSync.init({
server: './',
port: 3002
});
gulp.watch('./src/sass/*.scss', ['sass']);
// gulp.watch('./src/js/*.js', ['js']);
gulp.watch('./*.html').on('change', browserSync.reload);
});
gulp.task('sass', function () {
return gulp.src('./src/sass/*.scss')
.pipe(sass())
.pipe(gulp.dest('./dist/css'))
.pipe(cssnano())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./dist/css'))
.pipe(browserSync.stream());
});
// gulp.task('doc', shell.task([
// './node_modules/jsdoc/jsdoc.js src/js/ ./README.md -d ./doc'
// ]));
// gulp.task('js', function () {
// return gulp.src('src/js/*.js')
// .pipe(uglify())
// .pipe(rename({
// suffix: '.min'
// }))
// .pipe(gulp.dest('dist/js'))
// .pipe(browserSync.stream());
// });
gulp.task('ts', function () {
return gulp.src('./src/ts/*.ts')
.pipe(ts())
.pipe(gulp.dest('./dist/js'))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('dist/js'));
});
gulp.task('dist', ['sass', 'ts']);
gulp.task('default', ['serve']);