-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
92 lines (89 loc) · 3.13 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assets_inline: {
options: {
inlineLinkTags: true,
minify: false,
verbose: true
},
all: {
files: [{
src: 'TheKarte.html',
dest: 'dist/TheKarte.html'
},
{
src: 'TheKarte-2kml.html',
dest: 'dist/TheKarte-2kml.html'
},
{
src: 'TheKarte-geocoder-OSM-nominatim.html',
dest: 'dist/TheKarte-geocoder-OSM-nominatim.html'
},
],
},
},
jsbeautifier: {
files: ['*.html', 'src/*.js', 'Gruntfile.js', 'package.json'],
options: {
js: {
indent_size: 4,
preserve_newlines: true,
wrap_line_length: 0,
end_with_newline: true
},
css: {
indent_size: 4,
preserve_newlines: false,
max_preserve_newlines: 2,
end_with_newline: true
},
html: {
indent_size: 4,
preserve_newlines: true,
max_preserve_newlines: 2,
end_with_newline: true,
indent_inner_html: true,
indent_scripts: "keep",
extra_liners: ["head", "body", "/html", "script", "style"]
}
}
},
jshint: {
all: ['Gruntfile.js', 'src/*.js'],
options: {
esversion: 6
}
},
revision: {
options: {
property: 'git.revision',
ref: 'HEAD',
short: false
}
},
run: {
jsdoc: {
exec: 'jsdoc --private -d doc src/*.js'
},
insertVersion: {
exec: 'sed -i -e "s>package.json:description><%= pkg.description %>>" -e "s>package.json:version><%= pkg.version %>>" -e "s>git.revision><%= git.revision %>>" -e "s>package.json:homepage><%= pkg.homepage.replace(">"> "\>") %>>g" -e "s>package.json:license><%= pkg.license %>>g" TheKarte.html'
},
help: {
exec: 'grunt --help'
}
}
});
grunt.loadNpmTasks('grunt-assets-inline');
grunt.loadNpmTasks("grunt-jsbeautifier");
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-git-revision');
grunt.loadNpmTasks('grunt-run');
//Task(s)
grunt.registerTask('default', ['jsbeautifier']);
grunt.registerTask('doc', ['run:jsdoc']);
grunt.registerTask('format', ['jsbeautifier']);
grunt.registerTask('help', ['run:help']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('dist', ['revision', 'run:insertVersion', 'assets_inline', 'run:jsdoc']);
};