generated from graphlab-fr/opensphere-web-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·78 lines (65 loc) · 1.72 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
var gulp = require('gulp');
/**
* -----------------------
* Commande par DÉFAUT
* ---
* - Affichage du message "Hello world"
* -----------------------
*/
gulp.task('default', function () {
console.log('Hello world');
});
/**
* -----------------------
* Commandes de GÉNÉRATION
* ---
* - $ gulp css => compliation SCSS -> main.css + prefixage
* - $ gulp js => concatenation JS -> main.js
* -----------------------
*/
// https://www.npmjs.com/package/gulp-concat
var concat = require('gulp-concat');
gulp.task('js', function () {
return gulp.src('./dist/scripts/*.js')
.pipe(concat('main.js'))
.pipe(gulp.dest('./assets/'))
});
/**
* -----------------------
* Commandes de MINIFICATION
* ---
* - $ gulp minify => minification JS et CSS
* -----------------------
*/
https: //www.npmjs.com/package/gulp-clean-css
var minifyCss = require('gulp-clean-css');
gulp.task('minifyCSS', function () {
return gulp.src('./assets/*.css')
.pipe(minifyCss())
.pipe(gulp.dest('./assets/'));
});
// https://www.npmjs.com/package/gulp-minify
var minifyJs = require('gulp-minify');
gulp.task('minifyJS', function () {
return gulp.src('./assets/*.js')
.pipe(minifyJs({
ext: {
src: 'main.js'
}
}))
.pipe(gulp.dest('./assets/'));
});
gulp.task('minify', gulp.series('minifyCSS', 'minifyJS'));
/**
* -----------------------
* Commande d'AUTOMATISATION
* ---
* - $ gulp watch => activation des commandes de GÉNÉRATION
* -----------------------
*/
gulp.task('watch', function () {
gulp.watch('./dist/scripts/*.js', gulp.series('js'))
.on('change', function (event) {
console.log('JS updated');
});
});