diff --git a/.gitignore b/.gitignore index e89a4ff..b040643 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /node_modules/ /dist/ -example/dist +examples/*/dist \ No newline at end of file diff --git a/example/example.js b/examples/custom-template/example.js similarity index 100% rename from example/example.js rename to examples/custom-template/example.js diff --git a/example/logo.png b/examples/custom-template/logo.png similarity index 100% rename from example/logo.png rename to examples/custom-template/logo.png diff --git a/example/main.css b/examples/custom-template/main.css similarity index 100% rename from example/main.css rename to examples/custom-template/main.css diff --git a/example/template.html b/examples/custom-template/template.html similarity index 100% rename from example/template.html rename to examples/custom-template/template.html diff --git a/examples/custom-template/webpack.config.js b/examples/custom-template/webpack.config.js new file mode 100755 index 0000000..d979a9a --- /dev/null +++ b/examples/custom-template/webpack.config.js @@ -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') + ] +}; \ No newline at end of file diff --git a/examples/default/example.js b/examples/default/example.js new file mode 100755 index 0000000..13a1ca1 --- /dev/null +++ b/examples/default/example.js @@ -0,0 +1,4 @@ +require('./main.css'); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); \ No newline at end of file diff --git a/examples/default/main.css b/examples/default/main.css new file mode 100644 index 0000000..232a2cd --- /dev/null +++ b/examples/default/main.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/default/webpack.config.js b/examples/default/webpack.config.js new file mode 100755 index 0000000..bc44315 --- /dev/null +++ b/examples/default/webpack.config.js @@ -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() + ] +}; \ No newline at end of file diff --git a/examples/favicon/example.js b/examples/favicon/example.js new file mode 100755 index 0000000..13a1ca1 --- /dev/null +++ b/examples/favicon/example.js @@ -0,0 +1,4 @@ +require('./main.css'); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); \ No newline at end of file diff --git a/example/favicon.ico b/examples/favicon/favicon.ico similarity index 100% rename from example/favicon.ico rename to examples/favicon/favicon.ico diff --git a/examples/favicon/main.css b/examples/favicon/main.css new file mode 100644 index 0000000..232a2cd --- /dev/null +++ b/examples/favicon/main.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/favicon/template.html b/examples/favicon/template.html new file mode 100644 index 0000000..b7b4f97 --- /dev/null +++ b/examples/favicon/template.html @@ -0,0 +1,11 @@ + + + + + Example template + + + + + + \ No newline at end of file diff --git a/examples/favicon/webpack.config.js b/examples/favicon/webpack.config.js new file mode 100755 index 0000000..6fa5736 --- /dev/null +++ b/examples/favicon/webpack.config.js @@ -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') + ] +}; \ No newline at end of file diff --git a/examples/html-loader/example.js b/examples/html-loader/example.js new file mode 100755 index 0000000..13a1ca1 --- /dev/null +++ b/examples/html-loader/example.js @@ -0,0 +1,4 @@ +require('./main.css'); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); \ No newline at end of file diff --git a/examples/html-loader/favicon.ico b/examples/html-loader/favicon.ico new file mode 100644 index 0000000..be74abd Binary files /dev/null and b/examples/html-loader/favicon.ico differ diff --git a/examples/html-loader/logo.png b/examples/html-loader/logo.png new file mode 100644 index 0000000..d71b3d7 Binary files /dev/null and b/examples/html-loader/logo.png differ diff --git a/examples/html-loader/main.css b/examples/html-loader/main.css new file mode 100644 index 0000000..232a2cd --- /dev/null +++ b/examples/html-loader/main.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/html-loader/template.html b/examples/html-loader/template.html new file mode 100644 index 0000000..b7b4f97 --- /dev/null +++ b/examples/html-loader/template.html @@ -0,0 +1,11 @@ + + + + + Example template + + + + + + \ No newline at end of file diff --git a/example/webpack.config.js b/examples/html-loader/webpack.config.js similarity index 59% rename from example/webpack.config.js rename to examples/html-loader/webpack.config.js index b863bc6..a83e57b 100755 --- a/example/webpack.config.js +++ b/examples/html-loader/webpack.config.js @@ -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') ] diff --git a/examples/two-loaders/example.js b/examples/two-loaders/example.js new file mode 100755 index 0000000..13a1ca1 --- /dev/null +++ b/examples/two-loaders/example.js @@ -0,0 +1,4 @@ +require('./main.css'); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); \ No newline at end of file diff --git a/examples/two-loaders/logo.png b/examples/two-loaders/logo.png new file mode 100644 index 0000000..d71b3d7 Binary files /dev/null and b/examples/two-loaders/logo.png differ diff --git a/examples/two-loaders/main.css b/examples/two-loaders/main.css new file mode 100644 index 0000000..232a2cd --- /dev/null +++ b/examples/two-loaders/main.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/two-loaders/partial.html b/examples/two-loaders/partial.html new file mode 100644 index 0000000..47dc0f7 --- /dev/null +++ b/examples/two-loaders/partial.html @@ -0,0 +1,2 @@ +

Partial

+ \ No newline at end of file diff --git a/examples/two-loaders/template.html b/examples/two-loaders/template.html new file mode 100644 index 0000000..16801a0 --- /dev/null +++ b/examples/two-loaders/template.html @@ -0,0 +1,11 @@ + + + + + Example template + + + + {% include(require('html!./partial.html'), {}); %} + + \ No newline at end of file diff --git a/examples/two-loaders/webpack.config.js b/examples/two-loaders/webpack.config.js new file mode 100755 index 0000000..d56445b --- /dev/null +++ b/examples/two-loaders/webpack.config.js @@ -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') + ] +}; \ No newline at end of file