-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
136 lines (132 loc) · 3.08 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
module.exports = function(grunt) {
grunt.initConfig({
connect: {
app: {
options: {
port: 8000,
hostname: "*",
livereload: true
}
},
doc: {
options: {
port: 8001,
hostname: "*",
base: 'tmp/doc',
livereload: 35730
}
}
},
watch: {
options: {
livereload: true
},
js: {
files: ["js/**"],
tasks: ["jshint", 'browserify:main']
},
templates: {
files: "templates/*.hbs",
tasks: ["jshint"]
},
css: {
files: "css/*.css"
},
doc: {
files: "README.md",
tasks:["markdown"],
options: {
livereload: 35730
}
}
},
markdown: {
all: {
files: [
{
src: 'README.md',
dest: 'tmp/doc/README.md.html'
}
]
}
},
jshint: {
all: ["Gruntfile.js", "js/**"]
},
browserify: {
vendor: {
src: [
'bower_components/lodash/dist/lodash.js',
'bower_components/backbone/backbone.js',
'bower_components/faye/include.js',
],
dest: 'tmp/vendor.js',
options: {
shim: {
underscore: {
path: 'bower_components/lodash/dist/lodash.js',
exports: '_'
},
backbone: {
path: 'bower_components/backbone/backbone.js',
exports: 'Backbone'
}
}
}
},
main: {
src: ['js/main.js'],
dest: 'tmp/main.js',
options: {
external: ["_", "Backbone"],
transform: ['hbsfy'],
debug: true
}
},
build: {
src: ['js/main.js'],
dest: 'tmp/main.js',
options: {
external: ["_", "Backbone"],
transform: ['hbsfy']
}
}
},
uglify: {
app: {
files: {
'build/bundle.js': ['tmp/vendor.js', 'tmp/main.js']
}
}
},
cssmin: {
combine: {
files: {
'build/css/bundle.css': [
'bower_components/leaflet-dist/leaflet.css',
'css/fontello.css',
'css/main.css'
]
}
}
},
copy: {
assets: {
src: 'assets/*/**',
dest: 'build/'
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-markdown');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s).
grunt.registerTask('default', ['jshint', 'browserify:vendor', 'browserify:main', 'connect:app', 'watch:js', 'watch:templates', 'watch:css']);
grunt.registerTask('build', ['jshint', 'browserify:vendor', 'browserify:build', 'uglify', 'cssmin', 'copy']);
grunt.registerTask('doc', ['markdown', 'connect:doc', 'watch:doc']);
};