-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgulpfile.js
55 lines (48 loc) · 1.46 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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var config = {
jsPath: './assets/javascripts',
lessPath: './assets/stylesheets',
bowerDir: './bower_components'
}
gulp.task('bower', function() {
return $.bower().pipe(gulp.dest(config.bowerDir))
;
});
gulp.task('css', function() {
return gulp.src(config.lessPath + '/*-inputs.less')
.pipe($.less({
paths: [
config.lessPath,
config.bowerDir + '/bootstrap/less'
]
})
)
.pipe($.autoprefixer('last 2 version'))
.pipe(gulp.dest('./dist/css'))
.pipe(reload({stream:true}))
.pipe($.minifyCss())
.pipe($.rename({suffix: '-min'}))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('js', function() {
return gulp.src(config.jsPath + '/inputs.js')
.pipe(gulp.dest('./dist/js'))
.pipe(reload({stream:true}))
.pipe($.uglify())
.pipe($.rename({suffix: '-min'}))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('watch', function() {
gulp.watch(config.lessPath + '/**/*.less', ['css']);
gulp.watch(config.jsPath + '/**/*.js', ['js']);
gulp.watch('./index.html', reload);
});
gulp.task('serve', ['watch'], function() {
browserSync({
server: {
baseDir: ['./']
}
});
});
gulp.task('default', ['bower', 'css', 'js']);