-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
46 lines (41 loc) · 1.06 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var imagemin = require('gulp-imagemin');
var sourcemaps = require('gulp-sourcemaps');
var changed = require('gulp-changed');
var del = require('del');
var config = {
dist: 'dist/',
src: './',
markdown: './**/*.md',
imgin: 'images/**/*.{jpg,jpeg,png,gif,svg}',
scssin: 'scss/**/*.scss',
cssout: 'dist/css/',
imgout: 'dist/images/',
scssout: 'dist/',
};
gulp.task('sass', function() {
return gulp.src(config.scssin)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.scssout));
});
gulp.task('img', function() {
return gulp.src(config.imgin)
.pipe(changed(config.imgout))
.pipe(imagemin())
.pipe(gulp.dest(config.imgout));
});
gulp.task('copy-markdown', function() {
return gulp.src(config.markdown)
.pipe(gulp.dest(config.dist));
});
gulp.task('clean', function() {
return del([config.dist]);
});
gulp.task('build',
gulp.series('clean',
gulp.parallel('sass', 'img', 'copy-markdown')
)
);