-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
40 lines (34 loc) · 1.01 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
const gulp = require('gulp'),
{ watch, parallel } = require('gulp'),
minifyCSS = require('gulp-minify-css'),
concat = require('gulp-concat'),
prefix = require('gulp-autoprefixer'),
uglify = require('gulp-uglify')
const CSS_FILES = [
'./src/_eleventy/assets/css/*.css',
'!./src/_eleventy/assets/css/dist.min.css'
]
const JS_FILES = [
'./src/_eleventy/assets/js/*.js',
'!./src/_eleventy/assets/js/dist.min.js'
]
function styles(cb) {
return gulp.src(CSS_FILES)
.pipe(concat('dist.min.css'))
.pipe(minifyCSS())
.pipe(prefix('last 2 versions'))
.pipe(gulp.dest('./src/_eleventy/assets/css'))
}
function scripts(cb)
{
return gulp.src(JS_FILES)
.pipe(concat('dist.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./src/_eleventy/assets/js'));
}
const watcher = () => {
watch(CSS_FILES, { ignoreInitial: true }, styles)
watch(JS_FILES, { ignoreInitial: true }, scripts)
}
exports.default = parallel(styles, scripts)
exports.watch = watcher;