forked from voteflux/flux-website-v2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (42 loc) · 1.48 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
'use strict';
// imports
var gulp = require("gulp");
var browserSync = require("browser-sync");
var sass = require("gulp-sass");
var autoprefixer = require('gulp-autoprefixer');
var cleanCSS = require('gulp-clean-css');
var notify = require('gulp-notify');
var deploy = require('gulp-gh-pages');
var autoprefixerOptions = {
browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
};
gulp.task('serve', ['sass'], function() {
gulp.watch('./_sass/*.scss', ['sass']);
gulp.watch('**/*.html').on('change', browserSync.reload);
gulp.watch("css/*.css").on('change', browserSync.reload);
gulp.watch("js/*.js").on('change', browserSync.reload);
browserSync.init(null, {
reloadDelay: 500,
server: {
baseDir: './_site'
},
port: 9000,
notify: false
});
});
gulp.task('sass', function() {
return gulp.src('./_sass/*.scss')
.pipe(sass())
.on('error', notify.onError(function (error) {
return 'An error occurred while compiling sass.\nLook in the console for details.\n' + error;
}))
.pipe(autoprefixer(autoprefixerOptions))
.pipe(cleanCSS({debug: true}, function(details) {
console.log("file size before" + details.name + ': ' + details.stats.originalSize);
console.log("file size after" + details.name + ': ' + details.stats.minifiedSize);
}))
.pipe(gulp.dest("./css"))
.pipe(gulp.dest("./react-signup/css"))
.pipe(browserSync.stream());
});
gulp.task("default", ['serve']);