-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
35 lines (32 loc) · 950 Bytes
/
gulpfile.js
File metadata and controls
35 lines (32 loc) · 950 Bytes
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
const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
const postcss = require('gulp-postcss');
const tailwindcss = require('tailwindcss');
// compile scss into css
function style() {
// 1. scss source
return gulp.src('./scss/**/*.scss')
// 2 pass through sass compile
.pipe(sass().on('error', sass.logError))
// 2a. pass through tailwindcss via postcss
.pipe(postcss([
require('tailwindcss')
]))
// 3. output to css
.pipe(gulp.dest('./css'))
// 4. stream changes to all browser
.pipe(browserSync.stream());
}
function watch() {
browserSync.init({
server: {
baseDir: './'
}
});
gulp.watch('./scss/**/*.scss', style);
gulp.watch('./*.html').on('change', browserSync.reload);
gulp.watch('./js/**/*.js').on('change', browserSync.reload);
}
exports.style = style;
exports.watch = watch;