-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
82 lines (76 loc) · 1.75 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
var gulp = require('gulp')
var concat = require('gulp-concat')
var browserSync = require('browser-sync').create()
var babel = require('gulp-babel')
var cssnano = require('gulp-cssnano')
var lintspaces = require('gulp-lintspaces')
var postcss = require('gulp-postcss')
var postcss_import = require('postcss-import')
var postcss_url = require('postcss-url')
var postcss_cssnext = require('postcss-cssnext')
//var assets = require('./src/assets/assets')
gulp.task('css', () => {
var cssFiles = assets.css.map(handle => `src/assets/${handle}.css`)
return gulp.src(cssFiles)
//return gulp.src('src/assets/*.css')
.pipe(
lintspaces({
newlineMaximum: 3,
trailingspaces: true,
indentation: 'tabs'
}
))
.pipe(cssnano({
discardUnused: {
fontFace: false
}
}))
.pipe(concat('all.min.css'))
.pipe(
postcss([
postcss_import(),
postcss_url(),
postcss_cssnext({
features: {
rem: {
html: false
}
}
}),
//require('gulp-cssnano')(),
])
)
.pipe(gulp.dest('build/assets'))
})
//gulp.watch('src/assets/*.css', gulp.parallel('css'))
gulp.task('js', () => {
var jsFiles = assets.js.map(handle => `src/assets/${handle}.js`)
return gulp.src(jsFiles)
//return gulp.src('src/assets/*.js')
.pipe(
lintspaces({
newlineMaximum: 3,
trailingspaces: true,
indentation: 'tabs'
}
))
.pipe(
babel({
presets: ['babili'],
comments: false
})
)
.pipe(concat('all.min.js'))
.pipe(gulp.dest('build/assets'))
})
gulp.task('assets', gulp.parallel('css', 'js'))
gulp.task('copy-directories', () => {
return gulp.src([
'src/**/*.*'
], {
base: 'src/'
})
.pipe(gulp.dest('build'))
.pipe(browserSync.stream())
})
gulp.task('build', gulp.parallel(/*'assets',*/ 'copy-directories'))