-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
73 lines (63 loc) · 1.93 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
// Init
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var less = require('gulp-less');
var paths = {
js: [
'./bower_components/jquery/dist/jquery.js',
'./bower_components/bootstrap/js/transition.js',
'./bower_components/bootstrap/js/affix.js',
'./bower_components/bootstrap/js/alert.js',
'./bower_components/bootstrap/js/button.js',
'./bower_components/bootstrap/js/carousel.js',
'./bower_components/bootstrap/js/collapse.js',
'./bower_components/bootstrap/js/dropdown.js',
'./bower_components/bootstrap/js/modal.js',
'./bower_components/bootstrap/js/popover.js',
'./bower_components/bootstrap/js/scrollspy.js',
'./bower_components/bootstrap/js/tab.js',
'./bower_components/bootstrap/js/tooltip.js',
'./src/js/*.js'
],
jsWatch: './src/js/*.js',
less: './src/less/master.less',
lessWatch: './src/less/**/*.less',
build: 'template/assets/'
};
// JS
gulp.task('jshint', function () {
return gulp.src(paths.jsWatch)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.on('error', handleError);
});
gulp.task('js', ['jshint'], function() {
return gulp.src(paths.js)
.pipe(concat('scripts.js'))
.pipe(gulp.dest(paths.build + 'js'))
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest(paths.build + 'js'));
});
// LESS
gulp.task('less', function() {
return gulp.src(paths.less)
.pipe(less({compress: true}))
.on('error', handleError)
.pipe(gulp.dest(paths.build + 'css'));
});
// Task Definiitions
gulp.task('build', ['less', 'js']);
gulp.task('default', ['build']);
gulp.task('watch', function () {
gulp.watch(paths.jsWatch, ['js']);
gulp.watch(paths.lessWatch, ['less']);
});
// Functions
function handleError(err) {
console.log(err.toString());
this.emit('end');
}