This repository has been archived by the owner on Feb 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
132 lines (116 loc) · 3.92 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
/* jshint node:true */
var path = require('path');
var matchdep = require("matchdep");
module.exports = function(grunt) {
// autoload dependencies
matchdep.filterDev("grunt-*").forEach(grunt.loadNpmTasks);
grunt.registerTask('default', ['prepare', 'build', 'package']);
grunt.registerTask('prepare', ['uglify:libs']);
grunt.registerTask('build', ['sass', 'browserify', 'clean:build', 'copy:build', 'nodewebkit']);
grunt.registerTask('package', ['compress:winapp', 'compress:macapp']);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
paths: {
src: './src/',
modules: './src/modules/',
assets: './src/assets/',
libs: './src/libs/',
build: './build/',
wkCache: './webkitbuilds/cache/',
wkRelease: './webkitbuilds/releases/',
release: './webkitbuilds/releases/<%= pkg.name %>/'
},
uglify: {
libs: {
files: {
'<%=paths.assets %>libs.js': [
'<%=paths.libs %>jquery-2.1.0.js',
//'<%=paths.libs%>react.js'
'<%=paths.libs %>react-with-addons.js'
]
}
},
options: {
mangle: false//,
//beautify: true
}
},
sass: {
app: {
files: {
'<%=paths.assets%>styles.css': '<%=paths.src%>scss/styles.scss'
}
}
},
// not used by browserify
react: {
files: {
expand: true,
cwd: '<%=paths.src%>',
src: ['**/*.jsx'],
dest: '<%=paths.assets%>',
ext: '.js'
}
},
browserify: {
// TODO: libs.js could be included with noParse
options: {
transform: [require('grunt-react').browserify],
extension: 'jsx'
},
app: {
src: '<%=paths.src%>main.jsx',
dest: '<%=paths.assets%>main.js'
}
},
clean: {
build: ['<%=paths.build %>']
},
copy: {
build: {
nonull: true,
files: [
{ src: '<%=paths.src %>/index.html', dest: '<%=paths.build %>/index.html' },
{ src: '<%=paths.src %>/nodewebkit-package.json', dest: '<%=paths.build %>/package.json' },
{ expand: true, cwd: '<%=paths.modules %>/', src: ['**'], dest: '<%=paths.build %>/modules/' },
{ expand: true, cwd: '<%=paths.assets %>/', src: ['**'], dest: '<%=paths.build %>/assets/' }
]
}
},
nodewebkit: {
options: {
appName: '<%= pkg.name %>',
appVersion: '<%= pkg.version %>',
buildDir: '<%= paths.wkRelease %>',
cacheDir: '<%= paths.wkCache %>',
platforms: ['win','osx'],
version: '0.10.5'
},
src: ['<%=paths.build %>**/*']
},
compress: {
winapp: {
options: {
archive: '<%= paths.release %><%= pkg.name %>-win.zip'
},
files: [{
expand: true,
cwd: '<%= paths.release %>win/<%= pkg.name %>',
src: ['**'],
dest: '.'
}]
},
macapp: {
options: {
archive: '<%= paths.release %><%= pkg.name %>-mac.zip'
},
files: [{
expand: true,
cwd: '<%= paths.release %>mac',
src: ['**'],
dest: '.'
}]
}
}
});
};