-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (34 loc) · 975 Bytes
/
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
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var cssvars = require('postcss-simple-vars');
var nested = require('postcss-nested');
var cssImport = require('postcss-import');
var watch = require('gulp-watch');
var browserSync = require('browser-sync').create();
gulp.task('styles', function(){
return gulp.src('app/assets/styles/styles.css')
.pipe(postcss([cssImport, cssvars, nested, autoprefixer]))
.on('error', function(errorInfo){
console.log(errorInfo.toString());
this.emit('end');
})
.pipe(gulp.dest('app/styles'))
});
gulp.task('cssInject', ['styles'], function(){
return gulp.src('app/styles/styles.css')
.pipe(browserSync.stream());
});
gulp.task('watch', function(){
browserSync.init({
server: {
baseDir: "app"
}
});
watch('app/index.html', function(){
browserSync.reload();
});
watch('app/assets/styles/**/*.css', function(){
gulp.start('cssInject');
});
});