-
Notifications
You must be signed in to change notification settings - Fork 37
/
Gruntfile.js
executable file
·205 lines (187 loc) · 6.64 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to match all subfolders:
// 'test/spec/**/*.js'
// templateFramework: 'lodash'
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var yeomanConfig = {
app: 'app',
dist: 'dist'
};
grunt.initConfig({
yeoman: yeomanConfig,
clean: {
dist: ['.tmp', '<%= yeoman.dist %>/*'],
server: '.tmp'
},
// This task uses James Burke's excellent r.js AMD builder to take all
// modules and concatenate them into a single file.
requirejs: {
release: {
options: {
mainConfigFile: "app/scripts/config.js",
include: ["main"],
insertRequire: ["main"],
out: "dist/source.min.js",
optimize: "uglify",
// Since we bootstrap with nested `require` calls this option allows
// R.js to find them.
findNestedDependencies: true,
// Include a minimal AMD implementation shim.
name: "almond",
// Setting the base url to the distribution directory allows the
// Uglify minification process to correctly map paths for Source
// Maps.
baseUrl: "app/scripts",
// Wrap everything in an IIFE.
wrap: true,
// Do not preserve any license comments when working with source
// maps. These options are incompatible.
preserveLicenseComments: true
}
},
customizer: {
options: {
mainConfigFile: "app/scripts/config.js",
include: ["customizer"],
insertRequire: ["customizer"],
out: "dist/customizer.min.js",
optimize: "uglify",
findNestedDependencies: true,
name: "almond",
baseUrl: "app/scripts",
wrap: true,
preserveLicenseComments: true
}
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= yeoman.dist %>/images'
}]
},
jqueryui: {
files: [{
expand: true,
flatten: true,
cwd: '<%= yeoman.app %>',
src: 'bower_components/jquery.ui/themes/base/images/*.png',
dest: '<%= yeoman.dist %>/images'
}]
}
},
cssmin: {
dist: {
files: {
'<%= yeoman.dist %>/app.min.css': [
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/bower_components/jquery.ui/themes/base/*.css',
'<%= yeoman.app %>/bower_components/components-font-awesome/css/font-awesome.min.css',
'<%= yeoman.app %>/styles/bootstrap.css',
'<%= yeoman.app %>/bower_components/CodeMirror/lib/codemirror.css',
'<%= yeoman.app %>/bower_components/CodeMirror/addon/hint/show-hint.css',
'<%= yeoman.app %>/styles/main.css',
],
'<%= yeoman.dist %>/customizer.min.css': [
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/bower_components/jquery.ui/themes/base/*.css',
'<%= yeoman.app %>/bower_components/components-font-awesome/css/font-awesome.min.css',
'<%= yeoman.app %>/styles/bootstrap.css',
'<%= yeoman.app %>/styles/main.css',
'<%= yeoman.app %>/styles/customizer.css'
]
}
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,txt}',
'.htaccess',
'*.html',
'*.json',
'images/{,*/}*.{webp,gif,png}',
'bower_components/jquery/jquery.js',
'bower_components/components-font-awesome/css/font-awesome.min.css',
'bower_components/components-font-awesome/fonts/*.{ttf,eot,svg,woff,otf}',
'scripts/lib/flood/*.js'
]
}]
},
fonts: {
files: [{
expand: true,
dot: true,
flatten: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>/fonts',
src: [
'bower_components/components-font-awesome/fonts/*.{ttf,eot,svg,woff,otf}'
]
}]
}
},
bower: {
all: {
rjsConfig: '<%= yeoman.app %>/scripts/main.js'
}
},
processhtml: {
release: {
files: {
"dist/app.html": ["app/app.html"],
"dist/customizer.html": ["app/customizer.html"]
}
}
},
nodewebkit: {
options: {
version: '0.8.1',
build_dir: './dist_desktop', // Where the build version of my node-webkit app is saved
mac: true, // We want to build it for mac
win: true, // We want to build it for win
linux32: false, // We don't need linux32
linux64: false // We don't need linux64
},
src: ['./dist/**'] // Your node-wekit app
}
});
grunt.registerTask('build', [
'clean:dist',
'requirejs',
'imagemin',
'cssmin',
'copy',
'processhtml'
]);
grunt.registerTask('desktop', [
'clean:dist',
'requirejs',
'imagemin',
'cssmin',
'copy',
'processhtml',
'nodewebkit'
]);
grunt.registerTask('default', [
'build'
]);
};