forked from Licoy/wordpress-theme-puock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (66 loc) · 1.98 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
const gulp = require('gulp')
const babel = require('gulp-babel');
const less = require('gulp-less');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const plumber = require('gulp-plumber');
const concat = require('gulp-concat');
const concatCss = require('gulp-concat-css');
const minifyCSS = require('gulp-minify-css')
const _core_script = "assets/js/*.js"
const _libs_script = "assets/libs/basic/**/*.js"
const _core_style = "assets/style/*.less"
const _libs_style = "assets/libs/basic/**/*.css"
const _dist = "assets/dist"
gulp.task('style', function () {
return gulp.src(_core_style)
.pipe(plumber())
.pipe(less({
compress: true
}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(_dist + '/style'))
})
gulp.task('lib_style', function () {
return gulp.src(_libs_style)
.pipe(concatCss("libs.min.css",{
// inlineImports:false,
rebaseUrls:false
}))
.pipe(minifyCSS({
format: 'keep-breaks',
semicolonAfterLastProperty: true,
afterComment: true
}))
.pipe(gulp.dest(_dist + '/style'))
})
gulp.task('lib_script', function () {
return gulp.src(_libs_script)
.pipe(concat("libs.min.js"))
.pipe(uglify({
output: {
comments: true,
}
}))
.pipe(gulp.dest(_dist + '/js'))
})
gulp.task('script', function () {
return gulp.src(_core_script)
.pipe(plumber())
.pipe(rename({suffix: '.min'}))
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest(_dist + '/js'))
})
gulp.task('build', gulp.series(
'style',
'lib_style',
'script',
'lib_script',
))
gulp.task('watch', gulp.series('build', function () {
gulp.watch(_core_style, gulp.series('style'))
gulp.watch(_core_script, gulp.series('script'))
gulp.watch(_libs_script, gulp.series('lib_script'))
gulp.watch(_libs_style, gulp.series('lib_style'))
}))