-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (56 loc) · 1.42 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
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const postcssPresetEnv = require('postcss-preset-env');
const svgSprite = require('gulp-svg-sprite');
const concat = require('gulp-concat');
// CSS
gulp.task('css', function () {
return gulp.src('./src/css/styles.css')
.pipe(postcss([
require('postcss-import'),
postcssPresetEnv({
features: {
'nesting-rules': true
}
}),
require('tailwindcss'),
]))
.pipe(gulp.dest('./css'));
});
// icons
gulp.task('icons', function(done) {
gulp.src('**/*.svg', { cwd: './src/icons' })
.pipe(svgSprite(
config = {
mode: {
symbol: true
}
}
))
.pipe(gulp.dest('./_includes'));
done();
});
// js
gulp.task('js', function() {
return gulp.src('./src/js/*.js')
.pipe(concat('scripts.js'))
.pipe(gulp.dest('./js'));
});
// watching
gulp.task('watch:css', function() {
return gulp.watch(['./src/css/**/*.css'],
gulp.series('css'));
});
gulp.task('watch:icons', function() {
return gulp.watch(['./src/icons/**/*.svg'],
gulp.series('icons'));
});
gulp.task('watch:js', function() {
return gulp.watch(['./src/js/**/*.js'],
gulp.series('js'));
});
gulp.task('watch', gulp.parallel('watch:css', 'watch:icons', 'watch:js'));
// deafult task
gulp.task('default', gulp.parallel('watch'));
// build task
gulp.task('build', gulp.parallel('css'));