Skip to content

Commit 4ce2012

Browse files
committed
appcache
1 parent cf7bc3c commit 4ce2012

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

Gruntfile.js

+40-1
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,20 @@ module.exports = function (grunt) {
236236
usemin: {
237237
html: ['<%= yeoman.dist %>/{,*/}*.html'],
238238
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
239+
manifest: ['<%= yeoman.dist %>/manifest.appcache'],
239240
options: {
240-
assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
241+
assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images'],
242+
patterns: {
243+
manifest: [
244+
[/(scripts\/vendor\.js)/, 'Replacing reference to vendor.js'],
245+
[/(scripts\/scripts\.js)/, 'Replacing reference to vendor.js'],
246+
[/(scripts\/oldieshim\.js)/, 'Replacing reference to vendor.js'],
247+
[/(styles\/vendor\.css)/, 'Replacing reference to vendor.css'],
248+
[/(styles\/main\.css)/, 'Replacing reference to main.css'],
249+
[/(images\/red-dot\.png)/, 'Replacing reference to main.css'],
250+
[/(images\/green-dot\.png)/, 'Replacing reference to main.css']
251+
]
252+
}
241253
}
242254
},
243255

@@ -378,6 +390,32 @@ module.exports = function (grunt) {
378390
]
379391
},
380392

393+
manifest: {
394+
generate: {
395+
options: {
396+
basePath: '<%= yeoman.dist %>',
397+
cache: [
398+
'scripts/vendor.js',
399+
'scripts/scripts.js',
400+
'scripts/oldieshim.js',
401+
'styles/main.css',
402+
'images/green-dot.png',
403+
'images/red-dot.png',
404+
],
405+
network: ['*', 'http://*', 'https://*', '/listpdf'],
406+
preferOnline: true,
407+
verbose: true,
408+
timestamp: true,
409+
master: ['index.html']
410+
},
411+
src: [
412+
'views/*.html',
413+
'fonts/*.*'
414+
],
415+
dest: '<%= yeoman.dist %>/manifest.appcache'
416+
}
417+
},
418+
381419
// Test settings
382420
karma: {
383421
unit: {
@@ -429,6 +467,7 @@ module.exports = function (grunt) {
429467
'cssmin',
430468
'uglify',
431469
'filerev',
470+
'manifest',
432471
'usemin',
433472
'htmlmin'
434473
]);

README.asciidoc

+5
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ Yes. Whatami allows you to track each day where you wake up. You can visualize y
77
You can see a running demo here http://www.m-krausse.de/whatami
88

99
I am always open for any suggestions, feature requests and bug reports.
10+
11+
12+
13+
install
14+
npm install grunt-manifest --save-dev

app/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="no-js">
2+
<html class="no-js" manifest="manifest.appcache">
33
<head>
44
<meta charset="utf-8">
55
<title></title>

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"grunt-filerev": "^0.2.1",
2121
"grunt-google-cdn": "^0.4.0",
2222
"grunt-karma": "^0.9.0",
23+
"grunt-manifest": "^0.4.0",
24+
"grunt-modernizr": "0.6.0",
2325
"grunt-newer": "^0.7.0",
2426
"grunt-modernizr": "0.6.0",
2527
"grunt-ng-annotate": "^0.4.0",

0 commit comments

Comments
 (0)