-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
150 lines (136 loc) · 4.67 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglifyjs');
var less = require('gulp-less');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var server = require('gulp-server-livereload');
var install = require("gulp-install");
var run = require('gulp-run');
var devServerHost = 'localhost'; //require('ip').address();
gulp.task( 'server', ['build'], function() {
gulp.src('./www')
.pipe(server({
livereload: true,
clientConsole: false,
directoryListing: false,
open: false,
host: devServerHost,
port: 3000
}));
});
gulp.task('less', [], function(done) {
gulp.src('./less/style.less')
.pipe(less())
.on('error', function(error) {
console.error(error.toString());
this.emit('end');
})
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
gulp.task('watch', function() {
gulp.watch('./less/**/*.less', ['less']);
});
gulp.task('bootstrap', [], function(done) {
var ends = 5;
function end() {
if (--ends) return;
done();
}
gulp.src(['./node_modules/bootstrap/dist/**/', '!./**/npm.js'], {base: './node_modules/bootstrap/dist'})
.pipe(gulp.dest('./www/lib/bootstrap/'))
.on('end', end);
gulp.src(['./node_modules/bootstrap/docs/assets/js/ie10-viewport-bug-workaround.js'], {base: './node_modules/bootstrap/docs/assets'})
.pipe(gulp.dest('./www/lib/assets/'))
.on('end', end);
gulp.src(['./node_modules/html5shiv/dist/**/*'])
.pipe(gulp.dest('./www/lib/html5shiv/'))
.on('end', end);
gulp.src(['./node_modules/Respond.js/dest/**/*'])
.pipe(gulp.dest('./www/lib/respond/'))
.on('end', end);
gulp.src(['./node_modules/jquery/dist/*', '!./**/cdn'])
.pipe(gulp.dest('./www/lib/jquery/'))
.on('end', end);
});
gulp.task('angular-ui-bootstrap-install', function(done) {
//~ process.chdir('node_modules/angular-ui-bootstrap');
return gulp.src(['./node_modules/angular-ui-bootstrap/package.json'])
.pipe(gulp.dest('./node_modules/angular-ui-bootstrap'))
.pipe(install())
});
gulp.task('angular-ui-bootstrap-grunt', ['angular-ui-bootstrap-install'], function(done) {
run('grunt --base ./node_modules/angular-ui-bootstrap --gruntfile ./node_modules/angular-ui-bootstrap/gruntfile.js html2js build')
.exec('', function() {
done();
});
})
gulp.task('angular-ui-bootstrap', ['angular-ui-bootstrap-grunt'], function(done) {
var ends = 1;
function end() {
if (--ends) return;
done();
}
gulp.src(['./node_modules/angular-ui-bootstrap/dist/**/*.js'])
.pipe(rename(function (path) {
path.basename = 'angular-' + path.basename.replace(/-\d\..*?(\.min)?$/, '$1');
}))
.pipe(gulp.dest('./www/lib/angular/js/'))
.on('end', end);
// For use with non embeded templates
////gulp.src(['./node_modules/angular-ui-bootstrap/template/**'])
//// .pipe(gulp.dest('./www/template'))
//// .on('end', end);
})
gulp.task('angular', [], function(done) {
var ends = 6;
function end() {
if (--ends) return;
done();
}
gulp.src(['./node_modules/angular/angular.js', './node_modules/angular/**/angular.min.js'])
.pipe(gulp.dest('./www/lib/angular/js/'))
.on('end', end);
gulp.src(['./node_modules/angular-ui-router/release/**/*'])
.pipe(gulp.dest('./www/lib/angular/js/'))
.on('end', end);
gulp.src(['./node_modules/angular/angular-csp.css'])
.pipe(gulp.dest('./www/lib/angular/css/'))
.on('end', end);
gulp.src(['./node_modules//angular-animate/angular-animate.*'])
.pipe(gulp.dest('./www/lib/angular/js/'))
.on('end', end);
gulp.src(['./node_modules/angular-ui-bootstrap/src/*/*.js'])
.pipe(concat('angular-ui-bootstrap.js'))
.pipe(gulp.dest('./www/lib/angular/js'))
.on('end', end);
gulp.src(['./node_modules/angular-ui-bootstrap/src/*/*.js'])
.pipe(uglify('angular-ui-bootstrap.min.js',{
outSourceMap: true
}))
.pipe(gulp.dest('./www/lib/angular/js'))
.on('end', end);
});
gulp.task('require', [], function(done) {
var ends = 1;
function end() {
if (--ends) return;
done();
}
gulp.src(['./node_modules/requirejs/require.js'])
.pipe(gulp.dest('./www/lib/require'))
.on('end', end);
});
gulp.task('install', ['build', 'angular', 'require', 'bootstrap', 'angular-ui-bootstrap'], function(done) {
done()
});
gulp.task('build', ['less'], function(done) {
done()
});
gulp.task('default', ['watch', 'server']);