-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
109 lines (95 loc) · 2.94 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
96
97
98
99
100
101
102
103
104
105
106
107
108
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minify = require('gulp-minify');
//var imagemin = require('gulp-imagemin');
//var sourcemaps = require('gulp-sourcemaps');
var cleanCss = require('gulp-clean-css');
var rename = require("gulp-rename");
var util = require('gulp-util');
var convertEncoding = require('gulp-convert-encoding');
//var jasmine = require('gulp-jasmine');
//var jasmineBrowser = require('gulp-jasmine-browser');
var mocha = require('gulp-mocha');
var watch = require('gulp-watch');
var del = require('del');
var jsdoc = require('gulp-jsdoc3');
var Server = require('karma').Server;
var paths = {
data : './3d_data',
source_js : [ './src/js/*.js', '!./src/js/cesium' ],
source_images : './images/*',
source_css : './src/css/*',
dest_js : './build/js',
dest_images : './images',
dest_css : './build/css',
test : './test/*.js',
build : './build'
};
// 삭제가 필요한 디렉토리가 있는 경우
gulp.task('clean', function() {
return del([ paths.build ]);
});
//gulp.task('minify-js', [ 'clean' ], function() {
// return gulp.src( paths.source_js )
// .pipe(minify({
// ext:{
// src:'.js',
// min:'.min.js'
// },
// exclude: ['tasks'],
// ignoreFiles: ['.combo.js', '.min.js']
// }))
// .pipe(gulp.dest( paths.dest_js ))
//});
gulp.task('uglify', [ 'clean' ], function () {
return gulp.src(paths.source_js)
.pipe(uglify())
.pipe(rename({ suffix: '.min'}))
.pipe(gulp.dest( paths.dest_js));
});
//gulp.task('combine-js', [ 'clean' ], function() {
// return gulp.src(paths.source_js)
//// .pipe(stripeDebug())
// .pipe(uglify())
// //.pipe(rename({ suffix: '.min'}))
// .pipe(concat('all.js'))
// .pipe(gulp.dest(paths.dest_js));
//});
gulp.task('minify-css', [ 'clean' ], function() {
return gulp.src(paths.source_css)
.pipe(cleanCss({compatibility : 'ie8'}))
.pipe(gulp.dest(paths.dest_css));
});
// // Copy all static images
//gulp.task('images', [ 'clean' ], function() {
// return gulp.src(paths.images)
// // Pass in options to the task
// .pipe(imagemin({ optimizationLevel : 5}))
// .pipe(gulp.dest('./public/dist/image'));
//});
gulp.task('watch', function() {
gulp.watch( paths.source_js, ['uglify']);
});
//gulp.task('jasmine', function() {
// return gulp.src(['./src/js/*.js', './test/*.js'])
// .pipe(jasmineBrowser.specRunner())
// .pipe(jasmineBrowser.server({port: 8888}));
// });
//gulp.task('karma-jasmine', function (done) {
// new Server({
// configFile: __dirname + '/karma.conf.js',
// singleRun: true
// }, done).start();
//});
gulp.task('test', function() {
return gulp.src([ './test/*.js' ], {read : false})
.pipe(mocha({reporter : 'tap'}))
.on('error', util.log);
});
gulp.task('doc', function (cb) {
var config = require('./jsdoc.json');
gulp.src(['README.md', './src/js/*.js'], {read: false})
.pipe(jsdoc(config, cb));
});
gulp.task('default', [ 'uglify', 'minify-css', 'test', 'doc' ]);