html-webpack-plugin
Advanced tools
Comparing version 2.10.0 to 2.11.0
11
index.js
@@ -26,3 +26,4 @@ 'use strict'; | ||
excludeChunks: [], | ||
title: 'Webpack App' | ||
title: 'Webpack App', | ||
xhtml: false | ||
}, options); | ||
@@ -342,3 +343,3 @@ } | ||
var publicPath = typeof compilation.options.output.publicPath !== 'undefined' | ||
? compilation.options.output.publicPath | ||
? compilation.mainTemplate.getPublicPath({hash: webpackStatsJson.hash}) | ||
: path.relative(path.dirname(self.options.filename), '.').split(path.sep).join('/'); | ||
@@ -420,5 +421,7 @@ | ||
}); | ||
// Make tags self-closing in case of xhtml | ||
var xhtml = this.options.xhtml ? '/' : ''; | ||
// Turn css files into link tags | ||
var styles = assets.css.map(function (stylePath) { | ||
return '<link href="' + stylePath + '" rel="stylesheet">'; | ||
return '<link href="' + stylePath + '" rel="stylesheet"' + xhtml + '>'; | ||
}); | ||
@@ -434,3 +437,3 @@ // Injections | ||
if (assets.favicon) { | ||
head.push('<link rel="shortcut icon" href="' + assets.favicon + '">'); | ||
head.push('<link rel="shortcut icon" href="' + assets.favicon + '"' + xhtml + '>'); | ||
} | ||
@@ -437,0 +440,0 @@ // Add styles to the head |
{ | ||
"name": "html-webpack-plugin", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"description": "Simplifies creation of HTML files to serve your webpack bundles", | ||
@@ -12,2 +12,3 @@ "main": "index.js", | ||
"scripts": { | ||
"prepublish": "npm run test", | ||
"pretest": "semistandard", | ||
@@ -14,0 +15,0 @@ "test": "jasmine" |
@@ -16,3 +16,3 @@ HTML Webpack Plugin | ||
```shell | ||
$ npm install html-webpack-plugin@2 --save-dev | ||
$ npm install html-webpack-plugin --save-dev | ||
``` | ||
@@ -23,2 +23,4 @@ | ||
[Changelog](https://github.com/ampedandwired/html-webpack-plugin/blob/master/CHANGELOG.md) | ||
If you used the 1.x version please take a look at the [migration guide](https://github.com/ampedandwired/html-webpack-plugin/blob/master/migration.md) | ||
@@ -36,3 +38,3 @@ In case I missed something please open a pull request for it. | ||
```javascript | ||
var HtmlWebpackPlugin = require('html-webpack-plugin') | ||
var HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
var webpackConfig = { | ||
@@ -45,3 +47,3 @@ entry: 'index.js', | ||
plugins: [new HtmlWebpackPlugin()] | ||
} | ||
}; | ||
``` | ||
@@ -89,2 +91,3 @@ | ||
- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk) | ||
- `xhtml`: `true | false` If `true` render the `link` tags as self-closing, XHTML compliant. Default is `false` | ||
@@ -91,0 +94,0 @@ Here's an example webpack config illustrating how to use these options: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43119
705
259