-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
63 lines (54 loc) · 1.4 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
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const postcssPresetEnv = require('postcss-preset-env');
const svgSprite = require('gulp-svg-sprite');
// CSS
gulp.task('css', function () {
return gulp.src('./src/css/app.css')
.pipe(postcss([
require('postcss-import'),
postcssPresetEnv({
features: {
'nesting-rules': true
}
}),
require('tailwindcss'),
require('cssnano')
]))
.pipe(gulp.dest('./public/stylesheets'));
});
// icons
gulp.task('icons', function(done) {
gulp.src('**/*.svg', { cwd: './src/icons' })
.pipe(svgSprite(
config = {
mode: {
symbol: true
}
}
))
.pipe(gulp.dest('./views/partials'));
done();
});
// njk
gulp.task('njk', function(done) {
gulp.src('*.njk', { cwd: './src/views/partials' })
.pipe(gulp.dest('./views/partials'));
done();
});
// 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:njk', function() {
return gulp.watch(['./src/views/partials/*.njk'],
gulp.series('njk'));
});
gulp.task('watch', gulp.parallel('watch:css', 'watch:icons', 'watch:njk'));
// deafult task
gulp.task('default', gulp.parallel('watch'));