-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
46 lines (39 loc) · 1.11 KB
/
gulpfile.js
File metadata and controls
46 lines (39 loc) · 1.11 KB
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
var gulp = require('gulp'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
cssvars = require('postcss-simple-vars'),
nested = require('postcss-nested'),
cssImport = require('postcss-import'),
mixins = require('postcss-mixins'),
watch = require('gulp-watch'),
browserSync = require('browser-sync').create();
gulp.task('styles', function() {
return gulp.src('./site/assets/styles/styles.css')
.pipe(postcss([cssImport, mixins, cssvars, nested, autoprefixer]))
.on('error', function(errorInfo) {
console.log(errorInfo.toString());
this.emit('end');
})
.pipe(gulp.dest('./site/prod/styles'));
});
gulp.task('watch', function() {
browserSync.init({
notify: false,
server: {
baseDir: "./"
}
});
watch('./index.html', function() {
gulp.start('HTMLBrowserRefresh');
});
watch('./site/assets/styles/**/*.css', function() {
gulp.start('CSSBrowserInject');
});
});
gulp.task('CSSBrowserInject', ['styles'], function() {
return gulp.src('./site/prod/styles/styles.css')
.pipe(browserSync.stream());
});
gulp.task('HTMLBrowserRefresh', function() {
browserSync.reload();
});