-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
63 lines (55 loc) · 1.48 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
'use strict';
var connect = require('gulp-connect');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var plumber = require('gulp-plumber');
var stylish = require('jshint-stylish');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var env = process.env.NODE_ENV;
var distFolder = 'dist';
var isProduction = (env === 'production') ? true : false;
var jsFiles = [
'src/**/*.js',
'!src/lib/**/*.js'
];
gulp.task('uglify', function() {
return gulp.src('src/*.js')
.pipe(plumber())
.pipe(gulp.dest(distFolder))
.pipe(uglify({
mangle: false,
compress: {
drop_console: true,
global_defs: {
DEBUG: false
}
}
}))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest(distFolder));
});
gulp.task('css', function() {
return gulp.src('src/css/jquery.ambient.video.css')
.pipe(plumber())
.pipe(gulp.dest(distFolder));
});
gulp.task('lint', function() {
var lintFiles = jsFiles.concat('gulpfile.js');
return gulp.src(lintFiles)
.pipe(plumber())
.pipe(jscs())
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('watch', function() {
gulp.watch(jsFiles, ['build']);
gulp.watch('src/css/jquery.ambient.video.css', ['css']);
});
gulp.task('connect', ['build'], function() {
connect.server();
});
gulp.task('build', ['lint', 'css', 'uglify']);
gulp.task('default', ['connect', 'watch']);