-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
124 lines (107 loc) · 3.05 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
'use strict';
const ver = '2.0.0',
gulp = require('gulp'),
browserSync = require('browser-sync').create(),
scss = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
rename = require("gulp-rename"),
del = require('del'),
uglify = require("gulp-uglify"),
cssnano = require('gulp-cssnano'),
headerComment = require('gulp-header-comment'),
headerInfo = `
jQuery FlexTabs
Version: ${ver}
Repo: https://github.com/WahaWaher/flextabs-js
Author: Sergey Kravchenko
Contacts: wahawaher@gmail.com
License: MIT
`,
headerInfoTheme = `
jQuery FlexTabs Theme Default
Version: ${ver}
Repo: https://github.com/WahaWaher/flextabs-js
Author: Sergey Kravchenko
Contacts: wahawaher@gmail.com
License: MIT
`,
headerInfoThemeTemplate = `
jQuery FlexTabs Theme Template
Version: ${ver}
Repo: https://github.com/WahaWaher/flextabs-js
Author: Sergey Kravchenko
Contacts: wahawaher@gmail.com
License: MIT
`;
// BrowserSync
gulp.task('browser-sync', function() {
browserSync.init({
proxy: 'flextabs.js',
notify: false,
browser: 'chrome'
});
});
gulp.task('scss', function() {
return gulp.src('demo/scss/**/*.scss')
.pipe(scss({
outputStyle: "expanded",
indentType: "tab",
indentWidth: 1
})).pipe(autoprefixer({
browsers: ['last 2 versions'/*, '> 0.5%'*/], // github.com/ai/browserslist#queries
}))
.pipe(gulp.dest('demo/css'))
.pipe(browserSync.stream())
});
gulp.task('default', ['browser-sync', 'scss'], function() {
gulp.watch('demo/scss/**/*.scss', ['scss']);
gulp.watch('demo/**/*.js').on('change', browserSync.reload);
gulp.watch('demo/**/*.+(html|php)').on('change', browserSync.reload);
});
gulp.task('build', ['deldist', 'scss'], function() {
// js
gulp.src([
'demo/js/jquery.flextabs.js'
])
.pipe(headerComment(headerInfo))
.pipe(gulp.dest('dist'));
// js min
gulp.src('demo/js/jquery.flextabs.js')
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(headerComment(headerInfo))
.pipe(gulp.dest('dist'));
// css common
gulp.src([
'demo/css/jquery.flextabs.css',
])
.pipe(headerComment(headerInfo))
.pipe(gulp.dest('dist'));
// css common min
gulp.src('demo/css/jquery.flextabs.css')
.pipe(cssnano({ discardComments: { removeAll: true } }))
.pipe(rename({ suffix: '.min' }))
.pipe(headerComment(headerInfo))
.pipe(gulp.dest('dist'));
// css theme default
gulp.src([
'demo/css/jquery.flextabs.theme-default.css',
])
.pipe(headerComment(headerInfoTheme))
.pipe(gulp.dest('dist'));
// css theme default min
gulp.src('demo/css/jquery.flextabs.theme-default.css')
.pipe(cssnano({ discardComments: { removeAll: true } }))
.pipe(rename({ suffix: '.min' }))
.pipe(headerComment(headerInfoTheme))
.pipe(gulp.dest('dist'));
// css theme default
// gulp.src([
// 'demo/scss/jquery.flextabs.theme-template.scss',
// ])
// .pipe(headerComment(headerInfoThemeTemplate))
// .pipe(gulp.dest('dist'));
});
gulp.task('deldist', function() {
return del.sync('dist');
});