-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
129 lines (111 loc) · 3.79 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
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
style: {
options: {
cleancss: true
},
files: {
"css/dest/styles.min.css": "css/src/styles.less"
}
}
},
copy: {
styles: {
src: 'css/dest/styles.min.css',
dest: 'css/styles.min.css'
}
},
watch: {
grunt: {
files: ['Gruntfile.js'],
tasks: ['manifest']
},
styles: {
files: ['css/src/*.less'],
tasks: ['less:style', 'copy:styles', 'manifest']
},
other_files: {
files: [
'js/*.js',
'js/views/*.js',
'locales/*/*.json',
'static/*/*.html',
'templates/*.html'
],
tasks: ['manifest']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['less:style', 'copy:styles']);
grunt.registerTask('manifest',
'Generate HTML5 application cache manifest file',
function () {
var manifest_template,
manifest_date,
manifest_text;
manifest_date = grunt.template.today('dd-mm-yyyy HH:MM:ss');
manifest_template = [
"CACHE MANIFEST",
"# <%= manifest_date %>",
"index.html",
// CSS
"css/styles.min.css",
"css/bootstrap.min.css",
// JavaScript
"js/lib/backbone.min.js",
"js/lib/bootstrap.min.js",
"js/lib/i18next.min.js",
"js/lib/jquery.min.js",
"js/lib/require.min.js",
"js/lib/underscore.min.js",
"js/lib/backbone-min.map",
"js/lib/underscore-min.map",
"js/views/application.js",
"js/views/static.js",
"js/app.js",
"js/stegano.js",
"js/text.js",
// fonts
"fonts/glyphicons-halflings-regular.eot",
"fonts/glyphicons-halflings-regular.svg",
"fonts/glyphicons-halflings-regular.ttf",
"fonts/glyphicons-halflings-regular.woff",
// locales
"locales/dev/translation.json",
"locales/en/translation.json",
"locales/ru/translation.json",
"locales/ua/translation.json",
// Static pages
"/static/about/about_en.html",
"/static/about/about_ru.html",
"/static/about/about_ua.html",
"/static/help/help_en.html",
"/static/help/help_ua.html",
"/static/help/help_ru.html",
// templates
"/templates/upload_template.html",
// images
"/img/help/1.png",
"/img/help/2.png",
"/img/help/3.png",
"/img/help/4.png",
"/img/help/5.png",
"NETWORK:",
"*"
].join('\n');
manifest_text = grunt.template.process(manifest_template, {
data: {
manifest_date: manifest_date
}
});
grunt.file.write('cache.manifest', manifest_text);
grunt.log.ok('Manifest file created with date ' + manifest_date);
});
};