-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
152 lines (137 loc) · 4.44 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
142
143
144
145
146
147
148
149
150
151
var path = require('path');
var webpack = require('webpack');
var webpackConfig = require('./interface/webpack.config.js');
module.exports = function(grunt) {
grunt.initConfig({
dev: __dirname + '/dev',
//dist: '/mnt/f/soft/wamp64/www/kibella',
dist: __dirname + '/../kibella_dist',
interface: __dirname + '/interface',
clean: {
dist: {
src: ['<%= dist %>/interface/**']
},
dev: {
src: ['<%= dev %>/**']
}
},
copy: {
root: {
src: ['public/**', 'tempdata/kibella.sqlite', 'tempdata/.htaccess', 'index.php', 'kibella.ini', 'LICENSE.txt','.ovhconfig'],
dest: '<%= dist %>',
expand: true
},
backend: {
src: ['JSON_SQL_Bridge/**'],
dest: '<%= dist %>',
expand: true
},
interface: {
cwd: '<%= interface %>',
src: ['index.html', 'images/**', 'styles/*.css', 'styles/fonts/**','components/stringify/icons/**'],
dest: '<%= dist %>/interface',
expand: true
},
droot: {
src: ['public/**', 'index.php', 'kibella.ini', 'LICENSE.txt'],
dest: 'dev',
expand: true
},
dbackend: {
src: ['JSON_SQL_Bridge/**'],
dest: 'dev',
expand: true
},
dinterface: {
cwd: '<%= interface %>',
src: ['index.html', 'images/**', 'styles/*.css', 'styles/fonts/**','components/stringify/icons/**'],
dest: '<%= dev %>/interface',
expand: true
}
},
webpack: {
options: webpackConfig,
dist: {
// webpack options
entry: "<%= interface %>/app.js",
output: {
path: "<%= dist %>/interface",
// filename: "[hash].js",
filename: "index.js",
},
stats: {
colors: true,
modules: true,
reasons: true
},
// storeStatsTo: "xyz", // writes the status to a variable named xyz
// you may use it later in grunt i.e. <%= xyz.hash %>
progress: true,
failOnError: false, // don't report error to grunt if webpack find errors
plugins: webpackConfig.plugins.concat(
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: true
},
mangle: false,
output: {
comments: false
}
})
)
},
dev: {
entry: "<%= interface %>/app.js",
output: {
path: "<%= dev %>/interface",
// filename: "[hash].js",
filename: "index.js",
},
stats: {
// Configure the console output
colors: true,
modules: true,
reasons: true
},
progress: true,
failOnError: true, // don't report error to grunt if webpack find errors
// Use this if webpack errors are tolerable and grunt should continue
watch: true, // use webpacks watcher
// You need to keep the grunt process alive
/*watchOptions: {
aggregateTimeout: 500,
poll: true
},*/
// Use this when you need to fallback to poll based watching (webpack 1.9.1+ only)
keepalive: true, // don't finish the grunt task
// defaults to true for watch and dev-server otherwise false
// inline: true, // embed the webpack-dev-server runtime into the bundle
// hot: true, // adds the HotModuleReplacementPlugin and switch the server to hot mode
// Use this in combination with the inline option
}
}
});
grunt.registerTask('dist', 'Make the distribution folder', function() {
grunt.log.writeln('Compiling everything into dist/ folder ...');
grunt.task.run([
'clean:dist',
'copy:root',
'copy:backend',
'copy:interface',
'webpack:dist'
]);
});
grunt.registerTask('dev', 'Make the dev folder', function() {
grunt.log.writeln('Compiling everything into dev/ folder ...');
grunt.task.run([
'clean:dev',
'copy:droot',
'copy:dbackend',
'copy:dinterface',
'webpack:dev'
]);
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-webpack');
}