This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
112 lines (96 loc) · 2.63 KB
/
Gruntfile.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
module.exports = function(grunt) {
'use strict';
// measures the time each task takes
require('time-grunt')(grunt);
// Load the plugin that provides tasks.
require('load-grunt-tasks')(grunt);
// Load all custom tasks
grunt.loadTasks('tasks');
// Load grunt configurations
var options = {
config: { // set default configs location
src: 'tasks/configs/*.js'
},
pkg: grunt.file.readJSON('package.json'),
param: { // Project settings
src: 'public',
build: 'build',
tmp: '.tmp',
dst: 'dist',
pack: 'pack'
}
};
var configs = require('load-grunt-configs')(grunt, options);
// Define the configuration for all the tasks
grunt.initConfig(configs);
// Server
grunt.registerTask('server', ['express:dev', 'watch']);
// intemediate task to optimize web components
grunt.registerTask('polymermin', [
'copy:webComponent',
'vulcanize', // index.html -> index-csp.html/index-csp.js
'clean:unvulcanized', // rm index.html
'copy:vulcanized', // index-csp.html -> index.html & move script element
'clean:vulcanized', // rm index-csp.html
]);
// intemediate task to optimize resources
grunt.registerTask('optimize', [
'welcome', 'clean:dist',
'copy:build',
/*'polymermin',*/
'useminPrepare',
'concat:generated',
'cssmin:generated',
'uglify:generated',
'htmlmin',
'usemin'
]);
// generate static web to dist/
grunt.registerTask('static', [
'optimize',
'copy:static',
'copy:vendor', // customize tasks/configs/vendor_copy.js
'manifest',
'copy:appcache',
'clean:static'
]);
// generate package app to pack/
grunt.registerTask('pack', [
'optimize',
'clean:parts',
'copy:static',
'copy:vendor', // customize tasks/configs/vendor_copy.js
'copy:backgroundJs',
'copy:installPage',
'clean:pack',
'zip:pack'
]);
// copy firefox webapp manifest to chrome webapp json
grunt.registerTask('f2c', [
'welcome', 'copy:backupChrome', 'copy:firefox'
]);
// copy chrome webapp json to firefox webapp manifest
grunt.registerTask('c2f', [
'welcome', 'copy:backupFirefox', 'copy:chrome'
]);
// lint
grunt.registerTask('lint', [
'welcome', 'jshint', 'jscs', 'jsonlint', 'csslint', 'sloc'
]);
// Default server test task.
grunt.registerTask('default', [
'lint', 'mochacov:test'
]);
// Default client test task.
grunt.registerTask('test', [
'lint', 'mocha_phantomjs'
]);
// generate docs
grunt.registerTask('docs', [
'clean:docs', 'lint', 'jsdoc'
]);
// deploy github page
grunt.registerTask('github', [
'static', 'gh-pages'
]);
};