-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
122 lines (104 loc) · 2.7 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
var gulp = require('gulp');
var ngmin = require('gulp-ngmin');
var gutil = require('gulp-util');
var stylus = require('gulp-stylus');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var refresh = require('gulp-livereload');
var livereload = require('tiny-lr');
var server = livereload();
var config = {
livereload: {
port: 35729
},
path: {
scripts: [
'client/modules/index.js',
'client/modules/*.js',
'client/directives/index.js',
'client/directives/*.js',
'client/filters/index.js',
'client/filters/*.js',
'client/services/index.js',
'client/services/*.js',
'client/controllers/index.js',
'client/controllers/*/*.js',
'client/controllers/*.js',
'client/app.js',
'client/config.js',
'client/routes.js',
'!client/styles',
'!client/templates/'
],
styles: [
'public/stylesheets/*.css'
],
stylus: [
'client/styles/index.styl'
],
images: 'public/images/*.{png,jpg,gif}',
html: 'public/*.{html,ejs}'
},
build: {
script: 'scripts.js',
style: 'styles.css',
scripts: 'public/javascripts',
styles: 'public/stylesheets'
},
uglify: {
mangle: false,
output: {
'indent_level': 2
}
}
};
gulp.task('scripts', function(cb) {
return gulp.src(config.path.scripts)
.pipe(ngmin())
// .pipe(uglify(config.uglify))
.pipe(concat(config.build.script))
.pipe(gulp.dest(config.build.scripts))
.pipe(refresh(server));
});
gulp.task('styles', function(cb) {
return gulp.src(config.path.styles)
.pipe(refresh(server));
});
gulp.task('html', function(cb) {
return gulp.src(config.path.html)
.pipe(refresh(server));
});
gulp.task('stylus', function(cb) {
return gulp.src(config.path.stylus)
.pipe(stylus({ conpress: true }))
.pipe(concat(config.build.style))
.pipe(gulp.dest(config.build.styles))
.pipe(refresh(server));
});
gulp.task('uglify', function(cb) {
return gulp.src(config.path.scripts)
.pipe(uglify(config.uglify))
.pipe(gulp.dest(config.build.path));
});
gulp.task('lr-server', function(cb) {
server.listen(config.livereload.port, function(err) {
if (err) console.log(err);
});
});
gulp.task('watch', function(cb) {
gulp.watch(config.path.scripts, function(event) {
gulp.run('scripts');
});
gulp.watch(config.path.styles.concat(config.path.stylus), function(event) {
gulp.run('styles', 'stylus');
});
gulp.watch(config.path.html, function(event) {
gulp.run('html');
});
});
gulp.task('build', function(cb) {
gulp.run('scripts', 'styles', 'stylus', 'html');
});
gulp.task('default', function(cb) {
gulp.run('lr-server', 'build', 'watch');
});