Refactor examples
|
|
@ -1,3 +1,3 @@
|
|||
/node_modules/
|
||||
/dist/
|
||||
example/dist
|
||||
examples/*/dist
|
||||
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
|
@ -0,0 +1,22 @@
|
|||
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' }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'template.html'
|
||||
}),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
require('./main.css');
|
||||
var h1 = document.createElement('h1');
|
||||
h1.innerHTML = 'Hello world!';
|
||||
document.body.appendChild(h1);
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: snow;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
var HtmlWebpackPlugin = require('..');
|
||||
module.exports = {
|
||||
entry: './example.js',
|
||||
output: {
|
||||
path: __dirname + '/dist',
|
||||
publicPath: '',
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: 'style-loader!css-loader' },
|
||||
{ test: /\.png$/, loader: 'file-loader' }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin()
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
require('./main.css');
|
||||
var h1 = document.createElement('h1');
|
||||
h1.innerHTML = 'Hello world!';
|
||||
document.body.appendChild(h1);
|
||||
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: snow;
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
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' }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'HtmlWebpackPlugin example',
|
||||
favicon: 'favicon.ico',
|
||||
filename: 'favicon.html'
|
||||
}),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
require('./main.css');
|
||||
var h1 = document.createElement('h1');
|
||||
h1.innerHTML = 'Hello world!';
|
||||
document.body.appendChild(h1);
|
||||
|
After Width: | Height: | Size: 766 B |
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: snow;
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -14,26 +14,10 @@ module.exports = {
|
|||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'html-loader.html',
|
||||
template: 'html!./template.html'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'no-loader.html',
|
||||
template: 'template.html'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'HtmlWebpackPlugin example',
|
||||
favicon: 'favicon.ico',
|
||||
filename: 'index.min.html',
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: false,
|
||||
minifyJS: true,
|
||||
minifyCSS: true
|
||||
}
|
||||
template: 'html!./template.html'
|
||||
}),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
require('./main.css');
|
||||
var h1 = document.createElement('h1');
|
||||
h1.innerHTML = 'Hello world!';
|
||||
document.body.appendChild(h1);
|
||||
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: snow;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<h2>Partial</h2>
|
||||
<img src="logo.png">
|
||||
|
|
@ -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>
|
||||
{% include(require('html!./partial.html'), {}); %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
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' }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'blueimp-tmpl!template.html'
|
||||
}),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
};
|
||||