-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (39 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
var gulp = require('gulp'),
ts = require('gulp-typescript'),
concat = require('gulp-concat'),
sourcemaps = require('gulp-sourcemaps'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename');
gulp.task('scripts', function() {
var tsResult = gulp.src('app/*.ts')
.pipe(sourcemaps.init()) // This means sourcemaps will be generated
.pipe(ts({
sortOutput: true,
}));
return tsResult.js
.pipe(concat('output.js')) // You can use other plugins that also support gulp-sourcemaps
.pipe(sourcemaps.write()) // Now the sourcemaps are added to the .js file
.pipe(gulp.dest('release/js'))
});
gulp.task('styles', function() {
return gulp.src('./app/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('build/'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('build/'));
});
gulp.task('express', function() {
var express = require('express');
var app = express();
app.use(express.static(__dirname));
app.listen(4000, '0.0.0.0');
});
gulp.task('watch', function() {
gulp.watch('app/**/*.scss', ['styles']);
gulp.watch('app/**/*.ts', ['scripts']);
});
gulp.task('default', ['express', 'watch'], function() {
});