-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
64 lines (54 loc) · 1.58 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
"use strict";
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
del = require('del'),
connect = require('gulp-connect-php');
gulp.task('connect', function() {
connect.server();
});
//concat
gulp.task("concatScripts", function() {
return gulp.src([
'js/jquery.js',
'js/main.js'
])
.pipe(maps.init())
.pipe(concat('app.js'))
.pipe(maps.write('./'))
.pipe(gulp.dest('js'));
});
gulp.task("minifyScripts", ["concatScripts"], function() {
return gulp.src("js/app.js")
.pipe(maps.init())
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest('js'));
});
gulp.task('compileSass', function() {
return gulp.src("scss/styles.scss")
.pipe(maps.init())
.pipe(sass())
.pipe(maps.write('./'))
.pipe(gulp.dest('css'));
});
gulp.task('watchFiles', function() {
gulp.watch('scss/**/*.scss', ['compileSass']);
gulp.watch('js/main.js', ['concatScripts']);
gulp.watch('js/app.js', ['minifyScripts']);
});
gulp.task('clean', function() {
del(['dist', 'css/styles.css*', 'js/app*.js*']);
});
gulp.task("build", ['minifyScripts', 'compileSass'], function() {
return gulp.src(["css/styles.css", "js/app.min.js", 'emailHandler.php','index.php',
"img/**", "fonts/**"], { base: './'})
.pipe(gulp.dest('dist'));
});
gulp.task('serve', ['watchFiles', 'connect']);
gulp.task("default", ["clean"], function() {
gulp.start('build');
});