-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgruntfile.js
114 lines (107 loc) · 3.1 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
// ------------------------------------------------------------------------
// Gruntfile
// ------------------------------------------------------------------------
module.exports = function(grunt) {
"use strict"
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
version: "<%= pkg.version %>",
banner: "/*!\n" +
" * <%= pkg.name %> v<%= version %> (<%= pkg.homepage %>)\n" +
" * Copyright <%= grunt.template.today('yyyy') %> <%= pkg.author %>\n" +
" * Licensed under <%= pkg.license %>\n" +
" */\n",
dependencyCheck: "if (typeof jQuery === 'undefined' && typeof $ === 'undefined'){\n" +
"throw new Error('jQuery is required.')}\n" +
"if (typeof google === 'undefined' || typeof google.maps === 'undefined' || typeof google.maps.places === 'undefined') {\n" +
"throw new Error('Google Maps JavaScript API v3 with Places libary is required.')};",
// --------------------------------------------------------------------
// Grunt Tasks
// --------------------------------------------------------------------
babel: {
js: {
files: {
"<%= concat.geocomplete.dest %>" : "<%= concat.geocomplete.dest %>"
}
}
},
clean: {
js: ["<%= concat.geocomplete.dest %>"]
},
concat: {
geocomplete: {
src: ["src/js/**/*.js"],
dest: "src/js/main.js"
}
},
eslint: {
target: ["src/js/**/*.js"]
},
sass: {
expanded: {
options: {
outputStyle: "expanded"
},
files: {
"dist/<%= pkg.name %>.css" : "src/scss/master.scss"
}
},
compressed: {
options: {
outputStyle: "compressed"
},
files: {
"dist/<%= pkg.name %>.min.css" : "src/scss/master.scss"
}
}
},
stamp: {
banner: {
options: {
banner: "<%= banner %>"
},
files: {
src: "dist/*"
}
},
dependency: {
options: {
banner: "<%= dependencyCheck %>"
},
files: {
src: "<%= concat.geocomplete.dest %>"
}
},
},
uglify: {
dev: {
options: {
beautify: true,
compress: false,
mangle: false,
output: {
indent_level: 2,
comments: /\*/
}
},
src: "<%= concat.geocomplete.dest %>",
dest: "dist/<%= pkg.name %>.js",
},
dist: {
src: "<%= concat.geocomplete.dest %>",
dest: "dist/<%= pkg.name %>.min.js",
}
},
watch: {
js: {
files: ["src/js/**/*.js"],
tasks: ["concat", "stamp:dependency", "babel", "uglify:dev", "clean"]
}
}
})
require("load-grunt-tasks")(grunt)
require("time-grunt")(grunt)
grunt.registerTask("css", ["sass", "stamp:banner"])
grunt.registerTask("default", ["sass", "eslint", "concat", "stamp:dependency", "babel", "uglify", "stamp:banner", "clean"])
grunt.registerTask("lint", ["eslint"])
}