This repository has been archived by the owner on Feb 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
92 lines (82 loc) · 2.53 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
var gulp = require('gulp'),
tsc = require('gulp-typescript'),
tslint = require('gulp-tslint'),
sourcemaps = require('gulp-sourcemaps'),
del = require('del'),
typescript = require('typescript'),
plumber = require('gulp-plumber'),
Config = require('./gulpfile.config'),
config = new Config(),
$ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'del']
});
gulp.task('ts-lint', function () {
return gulp.src(config.allTypeScript)
.pipe(tslint())
.pipe(tslint.report('prose'));
});
gulp.task('compile-ts', ['ts-lint'],
function () {
var sourceTsFiles = [
config.allTypeScript,
config.libraryTypeScriptDefinitions,
config.appTypeScriptReferences
],
tsResult = gulp.src(sourceTsFiles)
.pipe(sourcemaps.init())
.pipe(tsc({
typescript: typescript,
module: 'commonjs',
target: 'ES5',
emitDecoratorMetadata: true,
declarationFiles: false,
noExternalResolve: true,
experimentalDecorators: true
}));
tsResult.dts
.pipe(gulp.dest('./client/app'));
return tsResult.js.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./client/app'));
});
gulp.task('watch', function() {
gulp.watch([config.allTypeScript], ['ts-lint', 'compile-ts']);
gulp.watch(['assets/stylesheets/pc/**/*.scss'], ['scss:pc']);
gulp.watch(['assets/stylesheets/sp/**/*.scss'], ['scss:sp']);
});
var routine = function(path) {
gulp.src(['assets/stylesheets/' + path + '/*.scss'])
.pipe($.plumber())
.pipe($.compass({
config_file : 'assets/stylesheets/config.rb',
comments : false,
css : 'assets/cache/css/' + path,
sass: 'assets/stylesheets/' + path + '/',
bundle_exec: true
}))
.pipe($.csscomb())
.pipe($.pleeease({
autoprefixer: {
browsers: ['last 2 versions', 'ie 9']
},
minifier: false // boolean
}))
.pipe($.concat(path + '.css'))
.pipe(gulp.dest('client/css/'));
}
// task for PC compass
gulp.task('scss:pc',function(){
routine('pc');
});
// task for Smartphone compass
gulp.task('scss:sp',function(){
routine('sp');
});
gulp.task('build', ['scss:pc', 'scss:sp', 'ts-lint', 'compile-ts']);
gulp.task('js-vendor', function(){
gulp.src(['assets/vendor/**/*.js'])
.pipe($.concatVendor('vendor.js'))
.pipe($.uglify({
preserveComments: 'some',
}))
.pipe(gulp.dest('client/app/'));
});