Add app cache example

This commit is contained in:
Jan Nicklas 2016-01-15 11:05:51 +01:00 committed by Jan Nicklas
parent 954aa98339
commit 64ff092c1f
5 changed files with 48 additions and 0 deletions

4
examples/appcache/example.js Executable file
View File

@ -0,0 +1,4 @@
require('./main.css');
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);

BIN
examples/appcache/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<img src="logo.png">
</body>
</html>

View File

@ -0,0 +1,30 @@
var AppCachePlugin = require('appcache-webpack-plugin');
var HtmlWebpackPlugin = require('../..');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './example.js',
output: {
path: __dirname + '/dist',
publicPath: '',
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') },
{ test: /\.png$/, loader: 'file-loader' },
{ test: /\.html$/, loader: 'html-loader?-removeOptionalTags' },
]
},
plugins: [
new AppCachePlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'template.html',
minify:{
removeComments:true,
collapseWhitespace:true
}
}),
new ExtractTextPlugin('styles.css')
]
};