-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathGruntfile.js
More file actions
99 lines (83 loc) · 2.19 KB
/
Copy pathGruntfile.js
File metadata and controls
99 lines (83 loc) · 2.19 KB
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
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
requirejs: {
compile: {
options: {
mainConfigFile: "app/js/app.js",
out: "dist/release/js/app.js",
name: "app"
}
}
},
clean: {
dist: [
'dist/*'
]
},
connect: {
livereload: {
options: {
port: 9001,
hostname: '0.0.0.0',
middleware: function(connect, options) {
return [ lrSnippet, folderMount(connect, '.') ];
}
}
}
},
shell: {
openBrowser: {
command: 'open http://localhost:<%= connect.livereload.options.port %>/tests/'
},
createLoaderFile: {
command: 'grunt',
options: {
stdout: true,
execOptions: {
cwd: 'loader'
}
}
}
},
regarde: {
main: {
files: ['app/**/*.js', '**/*.html' ],
tasks: [ 'livereload' ]
}
},
copy: {
main: {
files: [
{
src: [ 'app/img/*' ],
dest: 'dist/release/img/',
flatten: true, expand: true
},
{
src: [ 'app/css/*' ],
dest: 'dist/release/css/',
flatten: true, expand: true
}
]
}
}
});
grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.registerTask('build', ['clean', 'requirejs', 'copy']);
grunt.registerTask('server', [ 'livereload-start', 'connect', 'regarde' ]);
grunt.registerTask('browser', [ 'livereload-start', 'connect', 'shell:openBrowser', 'regarde' ]);
grunt.registerTask('default', 'server');
};