-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
63 lines (53 loc) · 1.55 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 gulp = require('gulp'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
del = require("del"),
minifyCss = require('gulp-minify-css'),
ghPages = require('gulp-gh-pages');
gulp.task('compileSass', function(){
//return mean is promise to return this, is used when one task depend on another
return gulp.src('scss/application.scss')
.pipe(maps.init())
.pipe(sass())
.pipe(minifyCss())
.pipe(rename("application.min.css"))
.pipe(maps.write('./'))
.pipe(gulp.dest('css'))
});
gulp.task('concatScripts', function(){
return gulp.src([
'js/jquery.js',
'js/slick/slick.js',
'js/main.js'])
.pipe(concat('app.js'))
.pipe(gulp.dest('js'))
});
gulp.task("minifyScripts",['concatScripts'], function(){
return gulp.src('js/app.js')
.pipe(uglify())
.pipe(maps.init())
.pipe(rename("main.min.js"))
.pipe(maps.write('./'))
.pipe(gulp.dest('js'));
});
gulp.task("watchFiles", function(){
gulp.watch('scss/**/*.scss', ['compileSass']);
gulp.watch('js/**/*.js', ['minifyScripts']);
});
gulp.task("build", ['compileSass','minifyScripts'], function(){
return gulp.src(["js/slick/**","css/application.min.**","js/main.min.js",
"index.html","img/**", "fonts/**"],{ base: "./"})
.pipe(gulp.dest("dist"));
});
gulp.task("clean", function(){
del("dist");
});
gulp.task('deploy', function() {
return gulp.src('./dist/**/*')
.pipe(ghPages());
});
gulp.task('default', ["clean", "build"]);