-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
141 lines (132 loc) · 4.47 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
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
'use strict';
var libs = ['bootstrap', 'vue', 'bootbox', 'lodash', 'vuex', 'vue-resource', 'vue-router', 'jquery', 'moment', 'epic-spinners/dist/lib/epic-spinners.min.js', 'nodemailer'];
module.exports = function(grunt) {
var tasks = {
browserify: {
ui: {
files: {
'build/ui/js/login.js': ['src/ui/js/login.js'],
'build/ui/js/signup.js': ['src/ui/js/signup.js'],
'build/ui/js/dashboard.js': ['src/ui/js/dashboard.js'],
'build/ui/js/shop.js': ['src/ui/js/shop.js'],
'build/ui/js/contact.js': ['src/ui/js/contact.js'],
'build/ui/js/commandPage.js': ['src/ui/js/commandPage.js'],
'build/ui/js/controlPanel.js': ['src/ui/js/controlPanel.js'],
'build/ui/js/productPage.js': ['src/ui/js/productPage.js'],
'build/ui/js/shoppingCart.js':['src/ui/js/shoppingCart.js']
},
options: {
transform: ['vueify']
}
},
docs: {
files: {
'build/docs/js/script.js': ['src/docs/js/script.js'],
},
options: {
external: null
}
},
vendor: {
src: [],
dest: 'build/ui/js/vendor.js',
options: {
external: null,
require: libs
},
},
options: {
external: libs
},
},
copy: {
server: {
files: [{
expand: true,
cwd: 'src/server',
src: ['**/*'],
dest: 'build/server/'
},
// {
// expand: true,
// cwd: 'src/server/bin',
// src: ['*'],
// dest: 'build/server/bin/'
// },
// {
// expand: true,
// cwd: 'src/server/database',
// src: ['*'],
// dest: 'build/server/database/'
// },
// {
// expand: true,
// cwd: 'src/server/routes',
// src: ['*'],
// dest: 'build/server/routes/'
// }
]
},
ui: {
files: [
{
expand: true,
cwd: 'src/ui/img',
src: ['**/*'],
dest: 'build/ui/img/'
},
{
expand: true,
cwd: 'src/ui',
src: ['*.html'],
dest: 'build/ui'
},
]
},
docs: {
files: [{
expand: true,
cwd: 'src/docs/',
src: ['**/*', '!**/*.js'],
dest: 'build/docs/',
extDot: 'first'
}, ]
}
},
//clean the build folder
clean: {
all: 'build',
client: 'build/client',
server: 'build/server',
docs: 'build/docs'
},
less: {
docs: {
files: {
'build/docs/css/docs.css': 'src/docs/css/docs.less'
}
},
vendor: {
files: {
'build/ui/style/vendor.css': 'src/ui/style/vendor.less'
}
}
},
eslint: {
gruntfile: 'Gruntfile.js',
server: ['src/server/**/*.js', '!src/server/server-tftp/**/*.js'],
ui: ['src/ui/**/*.js', 'src/ui/**/*.vue']
}
};
grunt.initConfig(tasks);
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('server', ['eslint:server', 'copy:server']);
grunt.registerTask('ui', ['eslint:ui', 'browserify', 'less', 'copy:ui']);
grunt.registerTask('docs', ['browserify:docs', 'copy:docs', 'less:docs']);
grunt.registerTask('fastui', ['eslint:ui', 'browserify:ui']);
grunt.registerTask('default', ['server', 'ui', 'docs']);
};