-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
89 lines (78 loc) · 1.87 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var gulp = require('gulp'),
/**
* Js gulp helpers
*/
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
/**
* SCSS gulp helpers
*/
sass = require('gulp-sass'),
cssmin = require('gulp-minify-css'),
concat = require('gulp-concat'),
/**
* Other
*/
package = require('./package.json'),
del = require('del'),
run = require('gulp-run'),
browserSync = require('browser-sync'),
reload = browserSync.reload;
gulp.task('default', ['serve']);
/**
* Running Bower
*/
gulp.task('bower', function() {
run('bower install').exec();
});
/**
* Cleaning dist/ folder
*/
gulp.task('clean', function(cb) {
del([package.dest.distjs, package.dest.distcss], cb);
});
/**
* Linting the app
*/
gulp.task('jshint', function () {
return gulp.src(package.paths.js)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
/**
* Compile the css
*/
gulp.task('build-css', function () {
return gulp.src(package.paths.sass)
.pipe(sass({ errLogToConsole : true }))
.pipe(concat(package.dest.style))
.pipe(cssmin())
.pipe(gulp.dest(package.dest.distcss));
});
gulp.task('make', function () {
return gulp.src(package.paths.js)
.pipe(concat(package.dest.app))
.pipe(uglify({ mangle : false }))
.pipe(gulp.dest(package.dest.distjs));
});
/**
* Running livereload server
*/
gulp.task('server', function() {
browserSync({
server: {
baseDir: './public'
}
});
});
/**
* Compiling resources and serving application
*/
gulp.task('serve', ['bower', 'clean', 'jshint', 'build-css', 'make', 'server'], function() {
return gulp.watch([
package.paths.js, package.paths.html, package.paths.sass
], [
'jshint', 'build-css', 'make', browserSync.reload
]);
});