-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
90 lines (78 loc) · 2.24 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
var gulp = require('gulp'),
wrap = require('gulp-wrap'),
watch = require('gulp-watch'),
concat = require('gulp-concat'),
less = require('gulp-less'),
rename = require('gulp-rename');
var paths = {
public: {
js: 'public/js',
css: 'public/css',
img: 'public/img',
fonts: 'public/fonts'
},
scripts: 'frontend/js/*.js',
images: 'frontend/img/*.*',
css: 'frontend/css/*.css',
bootstrap: {
fonts: 'bower_components/bootstrap/dist/fonts/*.{ttf,woff,eot,svg}',
js: 'bower_components/bootstrap/dist/js/bootstrap.min.js',
css: 'bower_components/bootstrap/dist/css/bootstrap.min.css'
},
jquery: 'bower_components/jquery/dist/jquery.min.js'
};
/**
* Copy assets
*/
gulp.task('build-vendor', ['copy-bootstrap-fonts', 'copy-bootstrap-js', 'copy-bootstrap-css', 'copy-jquery']);
gulp.task('copy-bootstrap-fonts', function() {
return gulp
.src(paths.bootstrap.fonts)
.pipe(gulp.dest(paths.public.fonts));
});
gulp.task('copy-bootstrap-css', function() {
return gulp
.src(paths.bootstrap.css)
.pipe(gulp.dest(paths.public.css));
});
gulp.task('copy-bootstrap-js', function() {
return gulp
.src(paths.bootstrap.js)
.pipe(gulp.dest(paths.public.js));
});
gulp.task('copy-jquery', function() {
return gulp
.src(paths.jquery)
.pipe(gulp.dest(paths.public.js));
});
/**
* Handle custom files
*/
gulp.task('build-custom', ['custom-images', 'custom-js', 'custom-css']);
gulp.task('custom-images', function() {
return gulp.src(paths.images)
.pipe(gulp.dest(paths.public.img));
});
gulp.task('custom-js', function() {
return gulp.src(paths.scripts)
.pipe(concat('app.js'))
.pipe(gulp.dest(paths.public.js));
});
gulp.task('custom-css', function() {
return gulp.src(paths.css)
.pipe(concat('app.css'))
.pipe(gulp.dest(paths.public.css));
});
/**
* Watch custom files
*/
gulp.task('watch', function() {
gulp.watch([paths.images], ['custom-images']);
gulp.watch([paths.css], ['custom-css']);
gulp.watch([paths.scripts], ['custom-js']);
});
/**
* Gulp tasks
*/
gulp.task('build', ['build-vendor', 'build-custom']);
gulp.task('default', ['build', 'watch']);