forked from angular/angular-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (73 loc) · 2.19 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
'use strict';
var gulp = require('gulp');
var processhtml = require('gulp-processhtml');
var concat = require('gulp-concat');
var del = require('del');
var templateCache = require('gulp-angular-templatecache');
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var insert = require('gulp-insert');
var moduleName = 'myApp';
gulp.task('processhtml', function() {
return gulp.src('app/index.html')
.pipe(processhtml())
.pipe(gulp.dest('dist'));
});
gulp.task('concatDeps', function() {
return gulp.src([
'./app/bower_components/angular/angular.min.js',
'./app/bower_components/angular-route/angular-route.min.js'
])
.pipe(concat('libs.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('concatCSS', function() {
return gulp.src([
'./app/bower_components/html5-boilerplate/dist/css/normalize.css',
'./app/bower_components/html5-boilerplate/dist/css/main.css',
'./app/app.css'
])
.pipe(concat('styles.css'))
.pipe(cssmin())
.pipe(gulp.dest('./dist/'));
});
gulp.task('moveModernizr', function() {
return gulp.src([
'./app/bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js'
])
.pipe(concat('modernizr.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('concatApp', ['templates'], function() {
return gulp.src([
'./app/app.js',
'./app/views/**/!(*_test).js',
'./app/components/**/!(*_test).js',
'./dist/templates.js'
])
.pipe(concat('app.js'))
.pipe(insert.append(
'angular.module(\'' + moduleName +
'\').config(function ($compileProvider) {' +
'$compileProvider.debugInfoEnabled(false);' +
'});'))
.pipe(ngAnnotate())
//.pipe(uglify())
.pipe(gulp.dest('./dist/'));
});
gulp.task('templates', function() {
return gulp.src([
'./app/view*/**/*.html'
])
.pipe(templateCache({
module: moduleName
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('clean:templates', ['concatApp', 'templates'], function() {
return del('./dist/templates.js');
});
gulp.task('default', ['processhtml', 'templates', 'concatApp',
'concatDeps', 'concatCSS', 'moveModernizr', 'clean:templates'
]);