-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
63 lines (56 loc) · 1.9 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
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
copy = require('gulp-copy'),
less = require('gulp-less'),
plumber = require('gulp-plumber'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
// Uglyfies js on to /tour/js/minjs
gulp.task('scripts', function () {
gulp.src('js/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest("tour/js/minjs"));
});
// Copy fonts to /tour/fonts to become part of the distribution
gulp.task('copy', function () {
gulp.src('bower_components/patternfly/dist/fonts/*')
.pipe(copy('tour/fonts', {prefix: 4}));
gulp.src('bower_components/patternfly/components/bootstrap/dist/fonts/*')
.pipe(copy('tour/fonts', {prefix: 6}));
gulp.src('bower_components/patternfly/components/font-awesome/fonts/*')
.pipe(copy('tour/fonts', {prefix: 5}));
gulp.src('bower_components/patternfly/components/jquery/dist/jquery.min.js')
.pipe(copy('tour/js', {prefix: 5}));
gulp.src('bower_components/i18next/i18next.min.js')
.pipe(copy('tour/js', {prefix: 5}));
});
// Compiles less on to /tour/css
gulp.task('less', function () {
gulp.src('less/**/*.less')
.pipe(plumber())
.pipe(less())
.pipe(gulp.dest('tour/css'))
.pipe(reload({stream: true}));
});
// reload server
gulp.task('browser-sync', function () {
browserSync({
server: {
baseDir: "./"
}
});
});
// Reload all Browsers
gulp.task('bs-reload', function () {
browserSync.reload();
});
// watch for changes on files
gulp.task('watch', function () {
gulp.watch('js/*.js', ['scripts']);
gulp.watch('less/*.less', ['less']);
gulp.watch("index.html", ['bs-reload']);
gulp.watch("tour/**/*.html", ['bs-reload']);
});
gulp.task('package', ['scripts', 'copy', 'less']);
gulp.task('default', ['scripts', 'copy', 'less', 'browser-sync', 'watch']);