-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (56 loc) · 1.4 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict';
var $ = require('gulp-load-plugins')();
// Include gulp
var gulp = require('gulp');
// Include plugins
var plumber = require('gulp-plumber');
var lazypipe = require('lazypipe');
var browserSync = require('browser-sync');
// Loading manifest
var manifest = require('asset-builder')('./manifest.json');
var config = manifest.config || {};
var paths = manifest.paths || {};
// Setting up sass lazypipe
var sassTasks = lazypipe()
.pipe($.plumber)
.pipe($.changed, paths.cssDir,{extension: '.css'})
.pipe($.sourcemaps.init)
.pipe($.compass, {
css: 'web/assets/css',
sass: 'web/assets/scss'
})
.pipe($.pleeease, {
autoprefixer: {
browsers: [
'last 2 versions', 'ie 9'
]
}
})
.pipe($.sourcemaps.write, '.');
// Define watch task
gulp.task('watch', ['styles', 'serve'], function() {
gulp.watch(paths.sass, ['styles']);
gulp.watch(paths.css, ['sync']);
});
// Define styles task
gulp.task('styles', function () {
return gulp.src(paths.sass)
.pipe(plumber(function (error) {
this.emit('end');
}))
.pipe(sassTasks())
.pipe(gulp.dest(paths.cssDir));
});
//Define sync task
gulp.task('sync', function (){
gulp.src(paths.css)
.pipe(browserSync.reload({stream: true}));
});
// Define serve task
gulp.task('serve', function() {
browserSync.init({
proxy: config.devUrl
});
});
// Default Task
gulp.task('default', ['watch']);