-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
54 lines (49 loc) · 1.45 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
/// <binding BeforeBuild='default' />
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var paths = {
sass: ['./scss/**/*.scss'],
tsc: ['./app/**/*.ts']
};
gulp.task('serve:before', ['watch']);
gulp.task('default', ['sass','tsc']);
gulp.task('sass', function (done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass())
.on('error', sass.logError)
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
// Run gulp watch in conjunction with Ionic serve to
// reflect live changes to TypeScript files in app directory
gulp.task('watch', function () {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.tsc, ['tsc']);
});
// Run gulp tsc to transpile your TypeScript files from
// app directory to www/js directory
gulp.task('tsc', function () {
var sourcemaps = require("gulp-sourcemaps");
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json');
return tsProject
.src('app')
.pipe(sourcemaps.init())
.pipe(ts(tsProject))
.js
.pipe(sourcemaps.write('./',
{
includeContent: true,
sourceRoot: function (file) {
return file.cwd + '\\js';
}
}))
.pipe(gulp.dest('www/js/'));
});