-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (39 loc) · 1.23 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
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./**/*.html',
],
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || []
})
// Variables
let postcss = require('gulp-postcss');
let autoprefixer = require('autoprefixer');
let tailwindcss = require('tailwindcss');
let postcss_scss = require('postcss-scss');
let gulp = require('gulp');
let sourcemaps = require('gulp-sourcemaps');
// Sass Plugins
let sass = require('gulp-sass');
let uglifycss = require('gulp-uglifycss');
let processors = [tailwindcss, autoprefixer, purgecss];
gulp.task(
'sass',
gulp.series(function() {
return gulp
.src('./src/style.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(postcss(processors, { syntax: postcss_scss }))
.pipe(sourcemaps.write('./dist/maps'))
.pipe(uglifycss())
.pipe(gulp.dest('./'));
})
);
gulp.task(
'watch',
gulp.series(function() {
gulp.watch('./**/*.scss', gulp.series('sass'));
gulp.watch('./**/*.html', gulp.series('sass'));
})
);
gulp.task('default', gulp.series('sass', 'watch'));