This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
gulpfile.js
75 lines (61 loc) · 1.63 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
67
68
69
70
71
72
73
74
75
var $ = require('gulp-load-plugins')();
var pkg = require('./package.json');
var gulp = require('gulp');
var del = require('del');
$.runSequence = require('run-sequence');
$.streamqueue = require('streamqueue');
gulp.task('build', function() {
$.runSequence(
'backupCustomConfig',
'setDefaultConfig',
'styles',
'resetCustomConfig',
'cleanupTmp'
);
});
gulp.task('backupCustomConfig', function() {
// move the custom config
gulp.src('./css/_config.scss')
.pipe($.rename('_config.scss.tmp'))
.pipe(gulp.dest('./css/'));
});
gulp.task('setDefaultConfig', function() {
// get the default config
return gulp.src('./css/_config.scss.sample')
.pipe($.rename('_config.scss'))
.pipe(gulp.dest('./css/'));
});
gulp.task('resetCustomConfig', function() {
// put the custom config back
return gulp.src('./css/_config.scss.tmp')
.pipe($.rename('_config.scss'))
.pipe(gulp.dest('./css/'));
});
gulp.task('cleanupTmp', function() {
return del('./css/_config.scss.tmp')
});
gulp.task('deleteCustomConfig', function() {
return del('./css/_config.scss')
});
var sass = function () {
return gulp.src('./css/main.scss')
.pipe($.sass({ compress: true, sourceMap: true }))
.on('error', $.util.log);
};
gulp.task('styles', function() {
return $.streamqueue(
{ objectMode: true },
gulp.src('css/normalize.css'),
sass()
)
.pipe($.cssmin())
.pipe($.rename({ basename: 'clean-greader' }))
.pipe(gulp.dest('./'));
});
gulp.task('watch', function() {
$.livereload.listen();
gulp.watch('./**/*.css', function(evt) {
$.livereload.changed(evt.path);
});
gulp.watch('./**/*.scss', [ 'styles' ]);
});