-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
43 lines (39 loc) · 1.18 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
// gulp modules
var gulp = require('gulp')
var plumber = require('gulp-plumber')
var sass = require('gulp-sass')
var notify = require("gulp-notify")
var livereload = require('gulp-livereload')
var minifyCSS = require('gulp-minify-css')
var watch = require('gulp-watch')
var sourcemaps = require('gulp-sourcemaps')
var rename = require('gulp-rename')
// styles
gulp.task('styles', function () {
gulp.src(['./assets/scss/style.scss'])
.pipe(plumber({
errorHandler: onError
}))
.pipe(sass())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./assets/css/'))
.pipe(minifyCSS({compatibility: 'ie8'}))
.pipe(rename(function (path) {
path.basename = path.basename + ".min";
}))
.pipe(gulp.dest('./assets/css/'))
.pipe(livereload());
});
// watch
gulp.task('watch', function () {
livereload.listen();
// Watch for changes
gulp.watch(['./assets/scripts/**/**.js', './assets/scripts/*.js']);
gulp.watch(['./assets/scss/**/*.scss', './assets/scss/*.scss'], ['styles']);
});
// running tasks
gulp.task('default', ['styles', 'watch']);
// helper
function onError(err) {
console.log(err);
}