cache manifest generation

This commit is contained in:
Antelle 2015-10-22 00:02:17 +03:00
parent 958c9ae124
commit c338cf097d
4 changed files with 23 additions and 4 deletions

View File

@ -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'
]);
};

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html manifest="manifest.appcache">
<head lang="en">
<meta charset="UTF-8">
<title>KeeWeb</title>
@ -15,4 +15,4 @@
<p>This app is written entirely in JavaScript. Please, enable JavaScript to run it.</p>
</noscript>
</body>
</html>
</html>

6
app/manifest.appcache Normal file
View File

@ -0,0 +1,6 @@
CACHE MANIFEST
# YYYY-MM-DD:v0.0.0
CACHE:
index.html

View File

@ -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",