-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
91 lines (80 loc) · 2.23 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
var gulp = require('gulp'),
minify = require('gulp-minify-css'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
ext_replace = require('gulp-ext-replace'),
rename = require('gulp-rename');
gulp.task('css', function(){
return gulp.src('css/*.*')
.pipe(minify())
.pipe(rename({suffix:'.min'}))
.pipe(gulp.dest('../dist/css'))
});
//move des ressoures
gulp.task('assets', function(){
return gulp.src('assets/**/*.*')
.pipe(gulp.dest('../dist/assets'))
});
gulp.task('models', function(){
return gulp.src('models/*.*')
.pipe(gulp.dest('../dist/models'))
});
gulp.task('index', function(){
return gulp.src('*.html')
.pipe(gulp.dest('../dist/'))
});
// compilation js
gulp.task('js', function(){
return gulp.src('js/*.js')
.pipe(ext_replace('.js','.min.js'))
.pipe(uglify())
.pipe(rename({suffix:'.min'}))
.pipe(gulp.dest('../dist/js'))
});
gulp.task('class', function(){
return gulp.src('js/class/*.js')
.pipe(ext_replace('.js','.min.js'))
.pipe(uglify())
.pipe(rename({suffix:'.min'}))
.pipe(gulp.dest('../dist/js/class'))
});
gulp.task('lib', function(){
return gulp.src('js/lib/*.js')
.pipe(ext_replace('.js','.min.js'))
.pipe(uglify())
.pipe(rename({suffix:'.min'}))
.pipe(gulp.dest('../dist/js/lib'))
});
gulp.task('tuto', function(){
return gulp.src('js/tuto/*.js')
.pipe(uglify())
.pipe(rename({suffix:'.min'}))
.pipe(gulp.dest('../dist/js/tuto'))
});
gulp.task('three', function(){
return gulp.src('bower_components/**/build/*.min.js')
.pipe(gulp.dest('../dist/js/lib'))
});
// WATCH
gulp.task('watch',function(){
gulp.watch('assets/**/*.*',['assets']);
gulp.watch('models/*.*',['models']);
gulp.watch('*.html',['index']);
gulp.watch('js/*.js',['js']);
gulp.watch('js/lib/*.js',['lib']);
gulp.watch('js/tuto/*.js',['tuto']);
gulp.watch('js/class/*.js',['class']);
gulp.watch('css/**/*.*',['css']);
});
gulp.task('export',function(){
gulp.watch('*.*',['assets']);
gulp.watch('*.*',['models']);
gulp.watch('*.*',['index']);
gulp.watch('*.*',['js']);
gulp.watch('*.*',['lib']);
gulp.watch('*.*',['tuto']);
gulp.watch('*.*',['three']);
gulp.watch('*.*',['class']);
gulp.watch('*.*',['css']);
});
gulp.task('default', ['watch']);