-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
97 lines (83 loc) · 2.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
'use strict';
var path = require('path');
var gulp = require('gulp');
var del = require('del');
var typescript = require('typescript');
var buildTools = require('via-build-tools');
var sass = require('gulp-sass');
var locations = new buildTools.config.Locations({
root: path.resolve(__dirname),
core: {
base: "src/core",
typescript: ["**/*.ts"],
definitions: ["../../typings/**/*.d.ts"]
},
targets: {
browser: {
base: "src/browser",
typescript: ["**/*.ts"],
main: "main",
definitions: []
},
electron: {
base: "src/electron",
typescript: ["**/*.ts"],
main: "main",
definitions: []
},
node: {
base: "src/node",
typescript: ["**/*.ts"],
main: "main",
definitions: []
}
}
});
buildTools.tasks.build(gulp, locations, {
tsc: {
typescript: typescript,
noExternalResolve: false,
module: "commonjs",
moduleResolution: "node"
}
});
buildTools.tasks.install(gulp, locations);
buildTools.tasks.project(gulp, locations);
buildTools.tasks.test(gulp, locations);
var jade = require("gulp-jade");
gulp.task('build.browser.jade', function(){
gulp.src(['src/browser/**/*.jade'], {base: 'src/browser'})
.pipe(jade({
locals: {}
}))
.pipe(gulp.dest('build/browser'))
});
gulp.task('build.browser.assets', function(){
return gulp.src([
'src/browser/**/*.css',
'src/browser/**/*.html',
'src/browser/**/*.jpg',
'src/browser/**/*.png',
'src/browser/**/*.svg'
], {base: 'src/browser'})
.pipe(gulp.dest('build/browser'));
});
gulp.task('build.browser.sass', function(){
return gulp.src(['src/browser/**/*.scss', 'src/browser/**/*.sass'], {base: 'src/browser'})
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('build/browser'));
});
gulp.task("build.browser", ["build.browser.systemjs", "build.browser.jade", 'build.browser.sass', "build.browser.assets"]);
gulp.task("build", ["build.browser", "build.node", "build.electron"]);
gulp.task('clean.node', function () {
return del(['build/node/**/*']);
});
gulp.task('clean.browser', function () {
return del(['build/browser/**/*', 'build/systemjs/**/*']);
});
gulp.task('clean.electron', function () {
return del(['build/electron/**/*']);
});
gulp.task('clean', function () {
return del(['build/**/*']);
});