forked from chyuaner/CHU-PredictSystem-UI
/
Gruntfile.js
132 lines (124 loc) · 3.33 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
const sass = require('node-sass');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
implementation: sass,
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
outputStyle: 'compressed'
},
files: {
'dist/css/index.css': 'src/scss/index.scss',
'dist/css/predict.css': 'src/scss/predict.scss',
'dist/css/chart.css': 'src/scss/chart.scss',
'dist/css/chart-no-js.css': 'src/scss/chart-no-js.scss'
}
}
},
copy: {
minjs: {
files: [
{
expand: true,
flatten: true,
cwd: 'bower_components/',
src: [
'jquery/dist/jquery.min.js',
'foundation/js/foundation.min.js',
'foundation/js/vendor/modernizr.js',
'floatThead/dist/jquery.floatThead.min.js',
'd3/d3.min.js',
'c3/c3.min.js',
'c3/c3.min.css',
'arg.js/dist/arg-1.4.js'
],
dest: 'dist/assets/'
}
]
},
main: {
files: [
{
expand: true,
cwd: 'src/',
src: ['images/**', 'docs/**', 'js/**', 'gsat/js/**', 'ast/js/**'],
dest: 'dist/'
}
]
}
},
htmlrefs: {
dist: {
expand: true,
cwd: 'src/',
src: '**/*.html',
dest: 'dist/',
options: {
includes: {
analytics: './src/ga.inc',
meta: './src/meta.inc',
footer: './src/footer.inc',
oldie: './src/old-ie.inc'
}
}
}
},
connect: {
server: {
options: {
hostname: 'localhost',
port: 8000,
base: 'dist',
middleware: function (connect, options, defaultMiddleware) {
var proxy = require('grunt-connect-proxy2/lib/utils').proxyRequest;
return [
// Include the proxy first
proxy
].concat(defaultMiddleware);
}
},
proxies: [
{
context: ['/gsat/api', '/ast/api'],
//host: 'predict.chu.edu.tw',
host: '140.126.120.79',
port: 80,
https: false,
changeOrigin: true,
rewrite: {
'^/gsat/api': '2020/gsat/api',
'^/ast/api': 'dev/ast/api',
}
}
]
}
},
watch: {
options: {
livereload: true
},
frontend: {
files: [
'src/**/*.js', 'src/**/*.html', 'src/**/*.inc',
'src/**/*.png', 'src/**/*.gif', 'src/**/*.jpg'
],
tasks: [ 'copy', 'htmlrefs' ]
},
stylesheet: {
files: [ 'src/scss/**/*.scss' ],
tasks: [ 'sass' ]
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-htmlrefs');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-connect-proxy2');
grunt.registerTask('default', ['copy', 'sass', 'htmlrefs', 'configureProxies:server', 'connect:server', 'watch']);
}