forked from jellekralt/angular-drag-scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (48 loc) · 1.05 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 browserSync = require('browser-sync').create();
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var modRewrite = require('connect-modrewrite');
var gulp = require('gulp');
var config = {
paths: {
scripts: ['./src/*.js']
}
};
// Build
gulp.task('build', function() {
return gulp.src(config.paths.scripts)
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('dist/'));
});
// Lint
gulp.task('lint', function() {
return gulp.src(config.paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Watch
gulp.task('watch', function() {
gulp.watch(config.paths.scripts, ['lint']);
});
// Serve
gulp.task('serve', ['watch'], function() {
browserSync.init({
server: {
baseDir: './',
middleware: [
modRewrite([
'^/$ /demo.html'
])
]
}
});
gulp.watch('*.html').on('change', browserSync.reload);
});
gulp.task('default', ['serve']);