forked from syncfusion/ej2-showcase-ts-webmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
80 lines (74 loc) · 1.97 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var fs = require('fs');
var gulp = require('gulp');
var webpack = require('webpack');
var webpackGulp = require('webpack-stream');
/**
* Compile script files
*/
gulp.task('scripts', function(done) {
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json', { typescript: require('typescript') });
var tsResult = gulp.src(['./src/**/*.ts', './spec/**/*.ts'], { base: '.' })
.pipe(ts(tsProject));
tsResult.js
.pipe(gulp.dest('./'))
.on('end', function() {
done();
});
});
/**
* Compile scss files
*/
gulp.task('styles', function() {
var sass = require('gulp-sass');
return gulp.src(['./styles/**/*.scss'], { base: './' })
.pipe(sass({
outputStyle: 'expanded',
includePaths: './node_modules/@syncfusion/'
}))
.pipe(gulp.dest('.'));
});
/**
* Bundle all module using webpack
*/
gulp.task('bundle', function() {
var webpackConfig = require(fs.realpathSync('./webpack.config.js'));
return gulp.src('')
.pipe(webpackGulp(webpackConfig, webpack))
.pipe(gulp.dest('.'));
});
/**
* Build ts and scss files
*/
gulp.task('build', function(done) {
var runSequence = require('run-sequence');
runSequence('scripts', 'styles', 'bundle', done);
});
/**
* Run test for samplebrowser
*/
gulp.task('test', function(done) {
var karma = require('karma');
new karma.Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: ['ChromeHeadless'],
browserNoActivityTimeout: 30000
}, function(e) {
done(e === 0 ? null : 'karma exited with status ' + e);
}).start();
});
/**
* Load the samples
*/
gulp.task('serve', ['build'], function (done) {
var browserSync = require('browser-sync');
var bs = browserSync.create('Essential JS 2');
var options = {
server: {
baseDir: './'
},
ui: false
};
bs.init(options, done);
});