forked from scottstamp/PokemonGo-Map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
128 lines (122 loc) · 4.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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'static/dist/css/app.built.css': [
'static/sass/main.scss',
'static/sass/pokemon-sprite.scss'
],
'static/dist/css/mobile.built.css': 'static/sass/mobile.scss',
'static/dist/css/statistics.built.css': 'static/css/statistics.css'
}
}
},
eslint: {
src: ['static/js/*.js', '!js/vendor/**/*.js']
},
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: {
'static/dist/js/app.built.js': 'static/js/app.js',
'static/dist/js/map.built.js': 'static/js/map.js',
'static/dist/js/mobile.built.js': 'static/js/mobile.js',
'static/dist/js/stats.built.js': 'static/js/stats.js',
'static/dist/js/statistics.built.js': 'static/js/statistics.js'
}
}
},
uglify: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n',
sourceMap: true,
compress: {
unused: false
}
},
build: {
files: {
'static/dist/js/app.min.js': 'static/dist/js/app.built.js',
'static/dist/js/map.min.js': 'static/dist/js/map.built.js',
'static/dist/js/mobile.min.js': 'static/dist/js/mobile.built.js',
'static/dist/js/stats.min.js': 'static/dist/js/stats.built.js',
'static/dist/js/statistics.min.js': 'static/dist/js/statistics.built.js'
}
}
},
minjson: {
build: {
files: {
'static/dist/data/pokemon.min.json': 'static/data/pokemon.json',
'static/dist/data/mapstyle.min.json': 'static/data/mapstyle.json',
'static/dist/locales/de.min.json': 'static/locales/de.json',
'static/dist/locales/fr.min.json': 'static/locales/fr.json',
'static/dist/locales/pt_br.min.json': 'static/locales/pt_br.json',
'static/dist/locales/ru.min.json': 'static/locales/ru.json',
'static/dist/locales/zh_cn.min.json': 'static/locales/zh_cn.json',
'static/dist/locales/zh_hk.min.json': 'static/locales/zh_hk.json'
}
}
},
clean: {
build: {
src: 'static/dist'
}
},
watch: {
options: {
interval: 1000,
spawn: true
},
src: {
files: ['**/*.html'],
options: { livereload: true }
},
js: {
files: ['**/*.js', '**/*.json', '!node_modules/**/*.js', '!static/dist/**/*.js', '!static/dist/**/*.json'],
options: { livereload: true },
tasks: ['js-lint', 'js-build']
},
css: {
files: '**/*.scss',
options: { livereload: true },
tasks: ['css-build']
}
},
cssmin: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'
},
build: {
files: {
'static/dist/css/app.min.css': 'static/dist/css/app.built.css',
'static/dist/css/mobile.min.css': 'static/dist/css/mobile.built.css',
'static/dist/css/statistics.min.css': 'static/dist/css/statistics.built.css'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-html-validation');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-minjson');
grunt.registerTask('js-build', ['babel', 'uglify', 'minjson']);
grunt.registerTask('css-build', ['sass', 'cssmin']);
grunt.registerTask('js-lint', ['eslint']);
grunt.registerTask('build', ['clean', 'js-build', 'css-build']);
grunt.registerTask('lint', ['js-lint']);
grunt.registerTask('default', ['build', 'watch']);
};