-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
111 lines (102 loc) · 4.6 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
module.exports = function(grunt) {
// Projektkonfiguration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/js/*.js',
dest: 'html/assets/js/<%= pkg.name %>.min.js'
},
bundle: {
src: 'html/assets/js/<%= pkg.name %>-bundle.js',
dest: 'html/assets/js/<%= pkg.name %>-bundle.min.js'
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'src/css',
src: ['*.css', '!*.min.css'],
dest: 'html/assets/css',
ext: '.min.css'
}]
},
bundle: {
files: [{
src: 'html/assets/css/<%= pkg.name %>-bundle.css',
dest: 'html/assets/css/<%= pkg.name %>-bundle.min.css'
}]
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'html/index.html': 'src/index.html',
'html/index_en.html': 'src/index_en.html'
}
}
},
copy: {
main: {
files: [
{expand: true, cwd: 'node_modules/bootswatch/dist/flatly/', src: ['bootstrap.min.css'], dest: 'html/assets/css/'},
{expand: true, cwd: 'node_modules/bootstrap/dist/js/', src: ['bootstrap.bundle.min.js'], dest: 'html/assets/js/'},
// Kopiere Highlight.js Dateien
{expand: true, cwd: 'src/vendor/highlight.js/', src: ['highlight.min.js'], dest: 'html/assets/js/'},
{expand: true, cwd: 'src/vendor/highlight.js/', src: ['javascript.min.js'], dest: 'html/assets/js/'},
{expand: true, cwd: 'src/vendor/highlight.js/', src: ['default.min.css'], dest: 'html/assets/css/'},
{expand: true, cwd: 'src/vendor/highlight.js/', src: ['atom-one-dark-reasonable.min.css'], dest: 'html/assets/css/'},
// Kopiere Fontawsome Dateien
{expand: true, cwd: 'src/vendor/fontawesome/', src: ['fontawesome.min.js'], dest: 'html/assets/js/'},
{expand: true, cwd: 'src/vendor/fontawesome/', src: ['fontawesome.min.css'], dest: 'html/assets/css/'},
],
},
},
concat: {
options: {
separator: '\n/* End of file */\n',
},
js: {
src: ['html/assets/js/bootstrap.bundle.min.js', 'html/assets/js/fontawesome.min.js', 'html/assets/js/highlight.min.js', 'html/assets/js/javascript.min.js'],
dest: 'html/assets/js/<%= pkg.name %>-bundle.js',
},
css: {
src: ['html/assets/css/bootstrap.min.css', 'html/assets/css/fontawesome.min.css', 'html/assets/css/default.min.css', 'html/assets/css/atom-one-dark-reasonable.min.css'],
dest: 'html/assets/css/<%= pkg.name %>-bundle.css',
},
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'src/images/',
src: ['**/*.{png,jpg,gif,svg}'],
dest: 'html/assets/images/'
}]
}
},
clean: {
js: ['html/assets/js/*', '!html/assets/js/<%= pkg.name %>-bundle.min.js', '!html/assets/js/<%= pkg.name %>.min.js'],
css: ['html/assets/css/*', '!html/assets/css/<%= pkg.name %>-bundle.min.css', '!html/assets/css/<%= pkg.name %>.min.css'],
images: ['html/assets/images/*']
}
});
// Diese Plugins stellt die Aufgaben bereit.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-imagemin');
// Standardaufgabe(n).
grunt.registerTask('default', ['copy', 'uglify:build', 'cssmin:target', 'htmlmin', 'concat:js', 'concat:css', 'uglify:bundle', 'cssmin:bundle', 'clean:images', 'imagemin', 'clean:js', 'clean:css']);
};