diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e7a5e4..732d868 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
Change History
==============
+v2.14.0
+----
+* Export publicPath to the template
+* Add example for inlining css and js
+
v2.13.0
----
* Add support for absolute output file names
diff --git a/examples/inline/dist/bundle.js b/examples/inline/dist/bundle.js
new file mode 100644
index 0000000..8387058
--- /dev/null
+++ b/examples/inline/dist/bundle.js
@@ -0,0 +1,60 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+ __webpack_require__(1);
+
+ console.log('Hello World');
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports) {
+
+ // removed by extract-text-webpack-plugin
+
+/***/ }
+/******/ ]);
\ No newline at end of file
diff --git a/examples/inline/dist/favicon.ico b/examples/inline/dist/favicon.ico
new file mode 100644
index 0000000..be74abd
Binary files /dev/null and b/examples/inline/dist/favicon.ico differ
diff --git a/examples/inline/dist/index.html b/examples/inline/dist/index.html
new file mode 100644
index 0000000..eb56c5e
--- /dev/null
+++ b/examples/inline/dist/index.html
@@ -0,0 +1,62 @@
+
Jade demo
\ No newline at end of file
diff --git a/examples/inline/dist/styles.css b/examples/inline/dist/styles.css
new file mode 100644
index 0000000..232a2cd
--- /dev/null
+++ b/examples/inline/dist/styles.css
@@ -0,0 +1,3 @@
+body {
+ background: snow;
+}
\ No newline at end of file
diff --git a/examples/inline/example.js b/examples/inline/example.js
new file mode 100755
index 0000000..74b36f7
--- /dev/null
+++ b/examples/inline/example.js
@@ -0,0 +1,4 @@
+'use strict';
+require('./main.css');
+
+console.log('Hello World');
diff --git a/examples/inline/favicon.ico b/examples/inline/favicon.ico
new file mode 100644
index 0000000..be74abd
Binary files /dev/null and b/examples/inline/favicon.ico differ
diff --git a/examples/inline/main.css b/examples/inline/main.css
new file mode 100644
index 0000000..232a2cd
--- /dev/null
+++ b/examples/inline/main.css
@@ -0,0 +1,3 @@
+body {
+ background: snow;
+}
\ No newline at end of file
diff --git a/examples/inline/readme.md b/examples/inline/readme.md
new file mode 100644
index 0000000..1d58a19
--- /dev/null
+++ b/examples/inline/readme.md
@@ -0,0 +1,4 @@
+# isomorphic jade example
+
+This example shows how to use a different template engine (in this case jade)
+to load the `time.jade` template on the backend and frontend.
diff --git a/examples/inline/template.jade b/examples/inline/template.jade
new file mode 100644
index 0000000..301b091
--- /dev/null
+++ b/examples/inline/template.jade
@@ -0,0 +1,10 @@
+doctype html
+html
+ head
+ meta(http-equiv="Content-type" content="text/html; charset=utf-8")
+ title #{htmlWebpackPlugin.options.title}
+ body
+ each cssFile in htmlWebpackPlugin.files.css
+ style !{compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
+ each jsFile in htmlWebpackPlugin.files.js
+ script !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()}
diff --git a/examples/inline/webpack.config.js b/examples/inline/webpack.config.js
new file mode 100755
index 0000000..581a2ad
--- /dev/null
+++ b/examples/inline/webpack.config.js
@@ -0,0 +1,26 @@
+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: /\.jade$/, loader: 'jade' }
+ ]
+ },
+ plugins: [
+ new HtmlWebpackPlugin({
+ inject: false,
+ template: 'template.jade',
+ filename: 'index.html',
+ favicon: 'favicon.ico',
+ title: 'Jade demo'
+ }),
+ new ExtractTextPlugin('styles.css')
+ ]
+};
diff --git a/index.js b/index.js
index c93f0db..762d096 100644
--- a/index.js
+++ b/index.js
@@ -215,13 +215,13 @@ HtmlWebpackPlugin.prototype.executeTemplate = function (templateFunction, chunks
// Template processing
.then(function () {
var templateParams = {
+ compilation: compilation,
webpack: compilation.getStats().toJson(),
webpackConfig: compilation.options,
htmlWebpackPlugin: {
files: assets,
options: self.options
- },
- compilation: compilation
+ }
};
var html = '';
try {
@@ -357,6 +357,8 @@ HtmlWebpackPlugin.prototype.htmlWebpackPluginAssets = function (compilation, chu
}
var assets = {
+ // The public path
+ publicPath: publicPath,
// Will contain all js & css files by chunk
chunks: {},
// Will contain all js files
diff --git a/lib/loader.js b/lib/loader.js
index 16b6ef1..e1af5e5 100644
--- a/lib/loader.js
+++ b/lib/loader.js
@@ -33,6 +33,7 @@ module.exports = function (source) {
// All templateVariables which should be available
// @see HtmlWebpackPlugin.prototype.executeTemplate
var templateVariables = [
+ 'compilation',
'webpack',
'webpackConfig',
'htmlWebpackPlugin'
diff --git a/package.json b/package.json
index c145c2f..856507d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "html-webpack-plugin",
- "version": "2.13.0",
+ "version": "2.14.0",
"description": "Simplifies creation of HTML files to serve your webpack bundles",
"main": "index.js",
"files": [