forked from hock/Manifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
172 lines (161 loc) · 5.01 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
htmlbuild: {
dist: {
src: ['src/index.html','src/edit.html','src/about.html','src/data.html'],
dest: 'dist/',
options: {
beautify: true,
sections: {
layout: {
header: 'src/lib/html/header.html',
launcher: 'src/lib/html/launcher.html',
navigation: 'src/lib/html/navigation.html',
footer: 'src/lib/html/footer.html'
}
},
data: {
baseurl: "https://manifest.supplystudies.com/dev/",
minify: ".min", // or .min
version: "0.2.3"
}
}
}
},
cssmin: {
target: {
files: [{
expand: true,
src: ['dist/css/Manifest-main.css','dist/css/Manifest-edit.css','dist/css/Manifest-static.css'],
ext: '.min.css'
}]
}
},
jshint: {
js: ['src/lib/js/*.js'],
options: { 'esversion': 6 }
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
sourceMap: true,
sourceMapIn: function(path) { return path + ".map";}
},
js: {
files : {
'dist/js/<%= pkg.name %>-lib.min.js' : 'dist/js/<%= pkg.name %>-lib.js',
'dist/js/<%= pkg.name %>-main.min.js' : 'dist/js/<%= pkg.name %>-main.js',
'dist/js/<%= pkg.name %>-static.min.js' : 'dist/js/<%= pkg.name %>-static.js',
'dist/js/<%= pkg.name %>-data.min.js' : 'dist/js/<%= pkg.name %>-data.js',
'dist/js/<%= pkg.name %>-edit.min.js' : 'dist/js/<%= pkg.name %>-edit.js',
'dist/services/manifester.min.js' : 'dist/services/manifester.js'
}
}
},
concat: {
options: {
sourceMap: true,
},
js_lib: {
src: ['src/lib/js/leaflet/leaflet.js', 'src/lib/js/inc/d3.v4.js', 'src/lib/js/inc/d3.sankey.js', 'src/lib/js/inc/jsondrop.js'],
dest: 'dist/js/<%= pkg.name %>-lib.js'
},
js_main: {
src: ['src/lib/js/inc/showdown.js','src/lib/js/inc/tinycolor.js','src/lib/js/leaflet/image.js','src/lib/js/leaflet/zoomhome.js', 'src/lib/js/leaflet/smoothzoom.js','src/lib/js/leaflet/edgebuffer.js','src/lib/js/leaflet/grate.js','src/lib/js/leaflet/geodesic.js','src/lib/js/manifest.js','src/lib/js/manifest-supplychain.js','src/lib/js/manifest-atlas.js','src/lib/js/manifest-ui.js','src/lib/js/inc/list.js','src/lib/js/manifest-visualization.js','src/lib/js/main.js'],
dest: 'dist/js/<%= pkg.name %>-main.js'
},
js_static: {
src: ['src/lib/js/static.js'],
dest: 'dist/js/<%= pkg.name %>-static.js'
},
js_data: {
src: ['src/lib/js/inc/list.js','src/lib/js/static.js','src/lib/js/data.js'],
dest: 'dist/js/<%= pkg.name %>-data.js'
},
js_edit: {
src: ['src/lib/js/inc/simplemde.js','src/lib/js/inc/jsoneditor.js','src/lib/js/edit.js'],
dest: 'dist/js/<%= pkg.name %>-edit.js'
},
js_services: {
src: ['src/services/manifester.js'],
dest: 'dist/services/manifester.js'
},
css_main: {
src: ['src/lib/css/fonts.css','src/lib/css/fa.css','src/lib/css/leaflet.css','src/lib/css/visualize.css','src/lib/css/manifest.css'],
dest: 'dist/css/<%= pkg.name %>-main.css'
},
css_edit: {
src: ['src/lib/css/fonts.css','src/lib/css/fa.css','src/lib/css/leaflet.css','src/lib/css/visualize.css','src/lib/css/simplemde.css','src/lib/css/editor.css'],
dest: 'dist/css/<%= pkg.name %>-edit.css'
},
css_static: {
src: ['src/lib/css/fonts.css','src/lib/css/fa.css','src/lib/css/editor.css'],
dest: 'dist/css/<%= pkg.name %>-static.css'
}
},
changelogcustomizable: {
changelog: {
options: {
start: null,
end: null,
header: 'Changelog',
dest: {
dir: './',
fileName: 'changelog',
extension: 'md'
},
type: 'all',
templates: {
features: {
regex: {
dev: /^(.*)feature(.*)$/gim,
release: /^(.*)release(.*)feature(.*)$/gim
},
template: '##FEATURE:\n\n{{#if features}}{{#each features}}{{> feature}}{{/each}}{{else}}{{/if}}\n'
},
feature: {
template: '\t{{{this}}}\n'
},
fixes: {
regex: {
dev: /^(.*)fixes #\d+:?(.*)$/gim,
release: /^(.*)release(.*)fixes #\d+:?(.*)$/gim
},
template: '##FIXES:\n\n{{#if fixes}}{{#each fixes}}{{> fix}}{{/each}}{{else}}{{/if}}\n'
},
fix: {
template: '\t{{{this}}}\n'
}
}
}}
},
watch: {
html: {
files: ['src/**/*.html'],
tasks: ['htmlbuild']
},
js: {
files: ['src/lib/**/*.js'],
tasks: ['jshint', 'concat']
},
srv: {
files: ['src/services/manifester.js'],
tasks: ['concat']
},
css: {
files: ['src/lib/**/*.css'],
tasks: ['concat']
},
}
});
// Load plugins
grunt.loadNpmTasks('grunt-html-build');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
// Set tasks
grunt.registerTask('default', ['htmlbuild', 'concat', 'cssmin', 'uglify']);
};