-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
63 lines (52 loc) · 1.87 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
/*
Copyright 2017 Atos Consulting Switzerland
This file is part of SharePoint-CSR-TS.
SharePoint-CSR-TS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SharePoint-CSR-TS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SharePoint-CSR-TS. If not, see <http://www.gnu.org/licenses/>.
*/
var gulp = require("gulp"),
clean = require("gulp-clean"),
ts = require("gulp-typescript"),
sourcemaps = require("gulp-sourcemaps"),
concat = require("gulp-concat"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
tsify = require("tsify");
var paths = {
ts: './source/**/*.ts',
dist: './dist',
js: './dist/**/*.js',
app: './dist/app.js',
bundle: './dist/csr.js',
sourceMaps: "./maps"
};
// Create typescript project
var tsProject = ts.createProject('tsconfig.json');
// Gulp Tasks
gulp.task('clean-scripts', function () {
return gulp.src('dist/**/*.js', {read: false})
.pipe(clean());
});
gulp.task('bundle', function () {
return browserify()
.add('./source/Override.ts')
.plugin(tsify)
.bundle()
.on('error', function (error) { console.error(error.toString()); })
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(gulp.dest('./dist/'));
});
gulp.task('watch', function() {
gulp.watch(paths.ts, ['bundle']);
});
gulp.task('default', ['clean-scripts', 'bundle', 'watch']);