-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
70 lines (61 loc) · 1.78 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
'use strict';
var gulp = require('gulp'),
connect = require('gulp-connect'),
path = require('path'),
$ = require('gulp-load-plugins')();
gulp.task('connect', function() {
connect.server({
root: 'src',
port: '8081',
livereload: true,
middleware: function(connect) {
return [
connect()
.use('/bower_components', connect.static('bower_components'))
.use('/tmp', connect.static('tmp'))
];
}
});
});
// Task used to reload all html files
gulp.task('html', function () {
gulp.src('./src/**/*.html')
.pipe(connect.reload());
});
// Task used to reload all css files
gulp.task('style', function () {
gulp.src('./src/assets/style/**/*.less')
.pipe($.less({
paths: [ path.join(__dirname, 'less', 'includes') ]
}))
.pipe(gulp.dest('./tmp/assets/css'))
.pipe(connect.reload());
});
// Task used to reload all css files
gulp.task('scripts', function () {
gulp.src(['./src/app/**/*.js',
'./src/assets/js/*.js'])
.pipe(connect.reload());
});
// Fonts
gulp.task('fonts', function() {
gulp.src([
'./bower_components/bootstrap/fonts/glyphicons-halflings-regular.*',
'./bower_components/font-awesome/fonts/fontawesome-webfont.*'
])
.pipe(gulp.dest('./tmp/assets/fonts'))
.pipe(connect.reload());
});
// Watch all files and reload when any change occurs
gulp.task('watch', function () {
gulp.watch(['./src/**/*.html'], ['html']);
gulp.watch(['./src/assets/style/**/*.less'], ['style']);
gulp.watch(['./src/app/**/*.js', './src/assets/js/*.js'], ['scripts']);
});
gulp.task('initialization', function() {
gulp.start('html');
gulp.start('style');
gulp.start('scripts');
gulp.start('fonts');
});
gulp.task('start', ['connect', 'initialization', 'watch', 'fonts']);