-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
executable file
·107 lines (94 loc) · 3.27 KB
/
Copy pathgulpfile.js
File metadata and controls
executable file
·107 lines (94 loc) · 3.27 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
var gulp = require('gulp');
var bs = require("browser-sync").create();
var stylus = require('gulp-stylus');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var jade = require('gulp-jade');
var notify = require('gulp-notify');
var svgSprite = require('gulp-svg-sprite');
var yaml = require('gulp-yaml');
var plumber = require('gulp-plumber');
var onError = function(err) {
notify.onError({
title: "Howly fuckin Shit!",
subtitle: "${error.plugin}: ${error.name} ",
message: "<%= error.message %>",
sound: "Hero"
})(err);
this.emit('end');
};
gulp.task('js', function () {
return gulp.src('app/build/js/**/*')
.pipe(gulp.dest('wwwroot/build/js'))
.pipe(bs.stream())
.pipe(notify('js task finished'))
});
gulp.task('js-watch', ['js'], bs.reload);
gulp.task('yaml', function () {
return gulp.src('app/build/data/*.yml')
.pipe(yaml({ schema: 'DEFAULT_SAFE_SCHEMA' }))
.pipe(gulp.dest('app/build/data/'))
.pipe(notify('yaml converted to json'))
});
gulp.task('yaml-watch', ['yaml'], bs.reload);
var MY_LOCALS = {
// projects: require('./app/build/data/data.json')
};
gulp.task('jade',['yaml'], function () {
return gulp.src(['app/**/*.jade', '!app/build/includes/**/*.jade','!app/build/layouts/**/*.jade'])
.pipe(plumber({errorHandler: onError}))
.pipe(jade({
pretty:true,
basedir:'./app/',
locals: MY_LOCALS
}))
.pipe(gulp.dest('wwwroot/'))
.pipe(bs.stream())
.pipe(notify('jade/html task finished'))
});
gulp.task('jade-watch', ['jade'], bs.reload);
gulp.task('styles', function () {
var processors = [
autoprefixer({browsers:['> 5%']})
];
return gulp.src('app/build/styl/app.styl')
.pipe(plumber({errorHandler: onError}))
.pipe(stylus())
.pipe(postcss(processors))
.pipe(gulp.dest('wwwroot/build/css/'))
.pipe(bs.stream())
.pipe(notify('styles task finished, yey!'))
});
gulp.task('styles-watch', ['styles'], bs.reload);
gulp.task('assets', function () {
return gulp.src(['app/assets/**/*', '!app/assets/{icons,icons/**}'])
.pipe(gulp.dest('wwwroot/assets/'))
.pipe(bs.stream())
});
gulp.task('assets-watch', ['assets'], bs.reload);
svgconfig = {
mode : {
symbol : true // Activate the «symbol» mode
}
};
gulp.task('svg', function () {
return gulp.src('app/assets/icons/*.svg')
.pipe(plumber({errorHandler: onError}))
.pipe(svgSprite(svgconfig))
.pipe(gulp.dest('app/assets/icons/'))
.pipe(notify('created svg sprite'))
});
gulp.task('svg-watch', ['svg'], bs.reload);
gulp.task('default', ['jade', 'styles', 'js', 'assets', 'svg'], function () {
bs.init({
server: "./wwwroot",
notify: false
});
gulp.watch("app/**/*.jade", ['jade-watch']);
gulp.watch("app/build/styl/**/*.styl", ['styles-watch']);
gulp.watch("app/build/js/*.js", ['js-watch']);
gulp.watch("app/assets/**/*", ['assets-watch']);
gulp.watch("app/assets/icons/*.svg", ['svg-watch']);
});
gulp.task('build', ['jade', 'styles', 'js', 'assets', 'svg'], function () {
});