-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
106 lines (79 loc) · 2.91 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
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var connect = $.connect;
var concat = require('gulp-concat');
var jade = require('jade');
var compressor = require('gulp-compressor');
var jslibs = [
"bower_components/angular/angular.min.js",
"bower_components/angular-route/angular-route.min.js",
"bower_components/angular-file-upload/angular-file-upload.min.js",
"bower_components/angular-filereader/angular-filereader.min.js",
"bower_components/angular-loading-bar/build/loading-bar.min.js",
"bower_components/angular-sanitize/angular-sanitize.min.js",
"bower_components/angular-scroll-glue/source/scrollglue.js",
"bower_components/angular-strap/dist/angular-strap.min.js",
"bower_components/angular-strap/dist/angular-strap.tpl.min.js",
"bower_components/angular-ui-router/release/angular-ui-router.min.js",
"bower_components/angular-ui-tree/dist/angular-ui-tree.min.js",
"bower_components/es5-shim/es5-shim.min.js",
"bower_components/lodash/lodash.min.js",
"bower_components/restangular/dist/restangular.min.js",
"bower_components/jquery/dist/jquery.min.js",
"bower_components/bootstrap/dist/js/bootstrap.min.js"
];
var csslibs = [
"bower_components/angular-loading-bar/build/loading-bar.min.css",
"bower_components/angular-ui-tree/dist/angular-ui-tree.min.css",
"bower_components/bootstrap/dist/css/bootstrap.min.css"
];
gulp.task('connect', function() {
connect.server({
root: 'production',
livereload: true,
fallback: 'production/assets/index.html'
});
});
gulp.task('watch', function(){
gulp.watch('source/styles/**/*.scss', ['sass']);
gulp.watch(['source/views/**/*.jade', 'source/*.jade'], ['jade']);
gulp.watch('source/app/**/*.coffee', ['coffee']);
});
gulp.task('jade', function() {
return gulp.src(['source/**/*.jade', 'source/*.jade'])
.pipe($.jade())
.pipe(gulp.dest('production/assets'))
.pipe(connect.reload());
});
gulp.task('sass', function() {
return gulp.src('source/styles/**/*.scss')
.pipe($.sass({ errLogToConsole: true, sourceComments: 'map', sourceMap: 'sass'}))
.pipe(gulp.dest('production/assets/css'))
.pipe(connect.reload());
});
gulp.task('compress', function() {
gulp.src('production/assets/js/libs.js')
.pipe($.uglify())
.pipe(gulp.dest('production/assets/js/golibs.js'))
});
gulp.task('coffee', function() {
gulp.src('source/app/**/*.coffee')
.pipe($.coffee())
.pipe(concat('app.js'))
.pipe(gulp.dest('production/assets/js'))
.pipe(connect.reload());
});
gulp.task('jslibs', function() {
gulp.src(jslibs)
.pipe(concat('libs.js'))
.pipe(gulp.dest('production/assets/js'))
});
gulp.task('csslibs', function() {
gulp.src(csslibs)
.pipe(concat('libs.css'))
.pipe(gulp.dest('production/assets/css'))
});
gulp.task('libs', ['jslibs', 'csslibs'])
gulp.task('compile', ['libs', 'sass', 'jade', 'coffee'])
gulp.task('server', ['compile', 'watch', 'connect']);
gulp.task('default', ['server']);