forked from jhades/angularjs-gulp-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
107 lines (101 loc) · 2.7 KB
/
gulpfile.js
File metadata and controls
107 lines (101 loc) · 2.7 KB
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
'use strict';
var gulp = require('gulp');
var chef = require('gulp-chef');
var CacheBuster = require('gulp-cachebust');
var _cachebust;
// use function to protect, share and lazy loading complex object.
var cachebust = function () {
if (!_cachebust) {
_cachebust = new CacheBuster();
}
return _cachebust;
};
var meal = chef({
dest: 'dist/',
clean: {
description: 'Cleans the build output'
},
bower: {
description: 'Runs bower to install frontend dependencies',
plugin: 'gulp-install',
src: 'bower.json'
},
sass: {
description: 'Runs sass, creates css source maps',
src: 'styles/*',
config: {
maps: 'maps/',
cachebust: cachebust
}
},
jshint: {
description: 'Runs jshint',
src: 'js/*.js'
},
script: {
description: 'Build a minified Javascript bundle - the order of the js files is determined by browserify',
dest: 'js/',
config: {
partials: {
src: 'partials/*.html',
file: 'templateCachePartials.js',
moduleName: 'todoPartials',
prefix: '/partials/'
},
entries: './js/app.js',
paths: ['js/controllers/', 'js/services/', 'js/directives/'],
transform: ['browserify-ngannotate'],
cachebust: cachebust
}
},
karma: {
description: 'Runs karma tests'
},
test: {
description: 'Build and runs karma tests',
series: ['script', 'karma']
},
markup: {
src: 'index.html',
config: {
cachebust: cachebust
}
},
build: {
description: 'Full build (except sprites), applies cache busting to the main page css and js bundles',
series: ['clean', { parallel: ['sass', 'jshint', 'script'] }, 'markup']
},
watch: {
description: 'Watches file system and triggers a build when a modification is detected',
task: 'build'
},
webserver: {
description: 'Launches a web server that serves files in the current directory',
plugin: 'gulp-webserver',
src: '.',
options: {
livereload: false,
directoryListing: true,
open: 'http://localhost:8000/dist/index.html'
}
},
serve: {
description: 'Launch a build upon modification and publish it to a running server',
task: { parallel: ['watch', 'webserver'] }
},
sprite: {
description: 'Generates a sprite png and the corresponding sass sprite map. This is not included in the recurring development build and needs to be run separately',
src: 'images/*.png',
options: {
imgName: 'todo-sprite.png',
cssName: '_todo-sprite.scss',
algorithm: 'top-down',
padding: 5
}
},
default: {
description: 'Installs and builds everything, including sprites',
task: ['sprite', 'build', 'karma']
}
});
gulp.registry(meal);