-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
76 lines (62 loc) · 2.21 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
'use strict'
var gulp = require('gulp');
// load plugins
var $ = require('gulp-load-plugins')({pattern: ['del', 'bower*', 'stream*', 'gulp-*', 'path']});
gulp.task('clean', function(cb){
return $.del(['lib/*', 'fonts/*'], cb);
});
gulp.task('bower', ['clean'], function(cb){
var libjs = gulp.src($.bowerFiles().ext('js').files)
.pipe($.concat('third-party.js'))
.pipe($.uglify())
.pipe($.rev())
.pipe(gulp.dest('./lib'))
var libcss = gulp.src($.bowerFiles().ext('css').files)
// .pipe($.less({
// paths: [ $.path.join(__dirname, 'less', 'includes') ]
// }))
.pipe($.concat('third-party.css'))
.pipe($.minifyCss())
.pipe($.rev())
.pipe(gulp.dest('./lib'))
var fonts = gulp.src($.bowerFiles().ext(['eot', 'woff', 'woff2', 'ttf', 'svg']).files)
.pipe(gulp.dest('./fonts'))
console.log($.bowerFiles().files);
var partials = gulp.src('partials/*.html')
.pipe($.angularTemplates({module:'Giggity', basePath: 'partials/'}))
var appjs = $.merge(
gulp.src(['./js/*.js']),
partials
)
.pipe($.concat('app.js'))
.pipe($.ngAnnotate())
.pipe($.uglify())
.pipe($.rev())
.pipe(gulp.dest('./lib'))
var appcss = gulp.src(['./css/*.css'])
.pipe($.concat('app.css'))
.pipe($.minifyCss())
.pipe($.rev())
.pipe(gulp.dest('./lib'))
return $.streamSeries(libjs, libcss, fonts, appjs, appcss);
});
gulp.task('index', ['bower'], function (cb) {
var target = gulp.src('index.html');
// It's not necessary to read the files (will speed up things), we're only after their paths:
var libSources = gulp.src(['./lib/third-party*'], {read: false});
var sources = gulp.src(['./lib/app*'], {read: false});
return target.pipe($.inject($.streamSeries(libSources, sources), {relative: true}))
.pipe(gulp.dest(''));
});
gulp.task('dev', function() {
var target = gulp.src('index.html');
var libSources = gulp.src($.bowerFiles().files)
// var libSources = gulp.src(['./lib/third-party*'], {read: false});
var sources = gulp.src(['./js/*', './css/*'], {read: false});
return target.pipe($.inject($.streamSeries(libSources, sources), {relative: true}))
.pipe(gulp.dest(''));
});
gulp.task('default', ['index'], function() {
return gulp.src('./lib/')
// .pipe($.git.add());
});