-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (45 loc) · 1.41 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
var gulp = require('gulp'),
postcss = require('gulp-postcss'),
concatCss = require('gulp-concat-css'),
cssnano = require('gulp-cssnano'),
concat = require('gulp-concat'),
purgecss = require('gulp-purgecss');
gulp.task('dev-css', function () {
return gulp.src('./src/css/page.css')
.pipe(postcss([
require('tailwindcss'),
require('autoprefixer'),
]))
.pipe(concatCss('page.css'))
.pipe(cssnano({
reduceIdents: false,
discardComments: {removeAll: true},
svgo: false
}))
.pipe(gulp.dest('./static/css/'))
});
gulp.task('build-css', function () {
return gulp.src('./src/css/page.css')
.pipe(postcss([
require('tailwindcss'),
require('autoprefixer'),
]))
.pipe(purgecss({
content: ['./layouts/**/*.html','./content/**/*.html'],
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
whitelist: [':focus', 'button', 'button:focus'],
// whitelistPatterns: [/(:\w+)/g]
}))
.pipe(concatCss('page.css'))
.pipe(cssnano({
reduceIdents: false,
discardComments: {removeAll: true},
svgo: false
}))
.pipe(gulp.dest('./static/css/'))
});
gulp.task('watchcss', function() {
gulp.watch('./src/css/*.css', gulp.series('procss'));
});
gulp.task('dev', gulp.series('dev-css'));
gulp.task('build', gulp.series('build-css'));