-
Notifications
You must be signed in to change notification settings - Fork 17
/
gulpfile.js
110 lines (97 loc) · 2.67 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
108
109
110
var gulp = require('gulp');
var sass = require('gulp-sass');
var gulp_concat = require('gulp-concat');
var jsmin = require('gulp-jsmin');
var cssmin = require('gulp-cssmin');
var gulp_file_include = require('gulp-file-include');
var browser_sync = require('browser-sync').create();
// SYNC HTML
gulp.task('include-html', function(){
gulp.src([
'./html/*.html'
])
.pipe(gulp_file_include())
// .pipe(htmlbeautify(options))
.pipe(gulp.dest('./public'))
.pipe(browser_sync.stream());
});
gulp.task( 'sass' , function() {
// copy old file no min
gulp.src([
'./sass/*.scss',
])
.pipe(sass())
.pipe(gulp_concat('t-datepicker.min.css'))
// .pipe(cssmin())
.pipe(gulp.dest('./public/theme/css'))
gulp.src([
'./sass/**/*.scss'
])
.pipe(sass())
.pipe(gulp.dest('./public/theme/css'))
.pipe(browser_sync.stream());
})
gulp.task( 'min-css' , function() {
// Min new name file and keep old file
gulp.src([
'./sass/**/*.scss',
'!./sass/*.scss',
'!./sass/themes/t-datepicker-main.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'))
gulp.src([
'./theme/js/*.js'
])
.pipe(gulp_concat('t-datepicker.min.js'))
// .pipe(jsmin())
.pipe(gulp.dest('./public/theme/js'))
.pipe(browser_sync.stream());
});
// COPY js
gulp.task('js-copy', function(){
gulp.src([
'./node_modules/perfect-scrollbar/dist/perfect-scrollbar.min.js'
])
.pipe(gulp.dest('./public/theme/libs/'))
});
// COPY Css
gulp.task('css-copy', function(){
gulp.src([
'./node_modules/perfect-scrollbar/css/perfect-scrollbar.css',
'./node_modules/converthtml/sass/convert-theme-default.scss'
])
.pipe(gulp_concat('_libs.scss'))
.pipe(gulp.dest('./sass/layout'))
});
// COPY Images
gulp.task('images-copy', function(){
gulp.src([
'./theme/images/*.png',
'./theme/images/*.jpg',
'./theme/images/*.svg',
'./theme/images/*.gif',
])
.pipe(gulp.dest('./public/theme/images'))
});
gulp.task("Sync", ['include-html', 'sass', 'js', 'min-css'], function(){
browser_sync.init({
server: {
baseDir: "./public"
}
});
gulp.watch(['./html/**/*.html'], ['include-html']);
gulp.watch(['./sass/**/*.scss'], ['sass']);
gulp.watch(['./sass/**/*.scss'], ['min-css']);
gulp.watch(['./theme/js/*.js'], ['js']);
})
gulp.task('default', ['Sync', 'js-copy', 'css-copy', 'images-copy']);