-
Notifications
You must be signed in to change notification settings - Fork 53
/
gulpfile.js
87 lines (76 loc) · 2.06 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var jsmin = require('gulp-jsmin');
var cssmin = require('gulp-cssmin');
var htmlbeautify = require('gulp-html-beautify');
var gulp_file_include = require('gulp-file-include');
var browser_sync = require('browser-sync').create();
// SYNC html
gulp.task('include-html', function(){
var options = {
"indent_size": 4
};
gulp.src([
'./html/*.html',
'./html/demos/*.html'
])
.pipe(gulp_file_include())
.pipe(htmlbeautify(options))
.pipe(gulp.dest('./public'))
.pipe(browser_sync.stream());
});
// SYNC sass
gulp.task('sass', function(){
gulp.src(['./sass/*.scss'])
.pipe(sass())
.pipe(cssmin())
.pipe(gulp.dest('./public/theme/css'))
.pipe(browser_sync.stream());
});
// SYNC js
gulp.task('js', function(){
gulp.src([
'./theme/js/*.js'
])
.pipe(gulp.dest('./public/theme/js'));
});
// COPY library js
gulp.task('copy-js', function(){
gulp.src([
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js',
'./theme/js/*.js'
])
// .pipe(concat('animate-scroll.min.js'))
// .pipe(jsmin())
.pipe(gulp.dest('./public/theme/js'));
});
// COPY fonts
gulp.task('copy-fonts', function(){
gulp.src([
'./theme/fonts/*'
])
.pipe(gulp.dest('./public/theme/fonts'));
});
// COPY images
gulp.task('copy-img', function(){
gulp.src([
'./theme/images/**/*.png',
'./theme/images/**/*.jpg',
'./theme/images/**/*.gif',
'./theme/images/**/*.svg'
])
.pipe(gulp.dest('./public/theme/images'));
});
gulp.task("Sync", ['include-html', 'sass', 'js'], function(){
browser_sync.init({
server: {
baseDir: "./public"
}
});
gulp.watch(['./html/**/*.html',], ['include-html']);
gulp.watch(['./sass/**/*.scss'], ['sass']);
gulp.watch(['./theme/js/*.js'], ['js']);
})
gulp.task('default', ['Sync', 'copy-js', 'copy-img', 'copy-fonts']);