-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
107 lines (102 loc) · 3.09 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
var gulp = require('gulp'),
clean = require('gulp-clean'),
gutil = require('gulp-util'),
jshint = require('gulp-jshint'),
minify = require('gulp-minify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
connect = require('gulp-connect'),
uglifyCss = require('gulp-uglifycss'),
compass = require('gulp-compass'),
del = require('del'),
runSequence = require('run-sequence');
gulp.task('clean', function() {
return del([
'dist/**/*'
]);
});
gulp.task('build-bower-lib', function() {
return gulp.src('bower_components/**/*')
.pipe(gulp.dest('dist/bower_components'));
})
gulp.task('build-root', function() {
return gulp.src(['index.html','main.js','themify-icons.css'])
.pipe(gulp.dest('dist/'));
});
gulp.task('build-images', function() {
return gulp.src(['images/**'])
.pipe(gulp.dest('dist/images'));
});
gulp.task('build-fonts', function () {
return gulp.src('fonts/**')
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('build-php', function () {
return gulp.src('php/**')
.pipe(gulp.dest('dist/php'));
});
gulp.task('build-templates', function () {
return gulp.src('templates/*.html')
.pipe(gulp.dest('dist/templates/'));
});
gulp.task('build-sourcejs', function() {
return gulp.src(['js/*.js'])
.pipe(concat('feedback.js'))
.pipe(gulp.dest('dist/js'));
});
gulp.task('build-customcss', function() {
return gulp.src(['css/*.css'])
.pipe(gulp.dest('dist/css'));
});
gulp.task('compass-build', function() {
gulp.src('sass/*.scss')
.pipe(compass({
config_file: 'config.rb',
css: 'css',
sass: 'sass'
}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('watch-js', function() {
gulp.watch('js/*.js', ['build-sourcejs']);
});
// gulp.task('watch-img', function() {
// gulp.watch('images/**', ['build-images']);
// });
gulp.task('watch-css', function() {
gulp.watch('css/*.css', ['build-customcss']);
});
gulp.task('compass-watch', function () {
gulp.watch('sass/*.scss', ['compass-build']);
});
gulp.task('watch-html', function() {
gulp.watch('templates/*.html', ['build-templates']);
});
gulp.task('watch-php', function() {
gulp.watch('php/*.php', ['build-php']);
});
gulp.task('watch-root', function() {
gulp.watch(['index.html','main.js','themify-icons.css'], ['build-root']);
});
gulp.task('connect', function() {
connect.server({
root: 'dist',
port: 8000,
host: '0.0.0.0'
});
});
gulp.task('jshint', function() {
return gulp.src('js/*js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
// default task
gulp.task('default', function() {
return runSequence('clean', 'build-root','build-templates', 'build-fonts','build-sourcejs','build-php', 'jshint', 'build-images', 'build-bower-lib','compass-build',
['watch-js', 'watch-css', 'watch-html','watch-root','watch-php','compass-watch','connect']
);
});
// task to run in production
gulp.task('build-prod', function() {
return runSequence('clean', 'build-root', 'build-sourcejs', 'build-customcss', 'compass-build', 'build-php', 'build-templates', 'build-fonts', 'build-images','build-bower-lib');
});