From c338cf097dba14453fb431564a8ecd2919ab7a38 Mon Sep 17 00:00:00 2001 From: Antelle Date: Thu, 22 Oct 2015 00:02:17 +0300 Subject: [PATCH] cache manifest generation --- Gruntfile.js | 16 ++++++++++++++-- app/index.html | 4 ++-- app/manifest.appcache | 6 ++++++ package.json | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 app/manifest.appcache diff --git a/Gruntfile.js b/Gruntfile.js index 045ffeed..8af40f0e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,7 +3,7 @@ var fs = require('fs'), path = require('path'); -var StringReplacePlugin = require("string-replace-webpack-plugin"); +var StringReplacePlugin = require('string-replace-webpack-plugin'); module.exports = function(grunt) { require('time-grunt')(grunt); @@ -108,6 +108,17 @@ module.exports = function(grunt) { } } }, + 'string-replace': { + manifest: { + options: { + replacements: [{ + pattern: '# YYYY-MM-DD:v0.0.0', + replacement: '# ' + new Date().toISOString().replace(/T.*/, '') + ':v' + require('./package').version + }] + }, + files: { 'dist/manifest.appcache': 'app/manifest.appcache' } + } + }, webpack: { js: { entry: { @@ -217,6 +228,7 @@ module.exports = function(grunt) { 'sass', 'postcss', 'inline', - 'htmlmin' + 'htmlmin', + 'string-replace' ]); }; diff --git a/app/index.html b/app/index.html index b59aa8a4..1fe0fa0e 100644 --- a/app/index.html +++ b/app/index.html @@ -1,5 +1,5 @@ - + KeeWeb @@ -15,4 +15,4 @@

This app is written entirely in JavaScript. Please, enable JavaScript to run it.

- \ No newline at end of file + diff --git a/app/manifest.appcache b/app/manifest.appcache new file mode 100644 index 00000000..d7d62597 --- /dev/null +++ b/app/manifest.appcache @@ -0,0 +1,6 @@ +CACHE MANIFEST + +# YYYY-MM-DD:v0.0.0 + +CACHE: +index.html diff --git a/package.json b/package.json index 560334dd..64dcf3de 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "grunt-inline-alt": "^0.3.10", "grunt-postcss": "^0.6.0", "grunt-sass": "^1.0.0", + "grunt-string-replace": "^1.2.0", "grunt-webpack": "^1.0.11", "load-grunt-tasks": "^3.2.0", "string-replace-webpack-plugin": "0.0.2",