Add xhtml option to readme and add tests
This commit is contained in:
parent
bf5901e5c0
commit
f8abc156b5
|
|
@ -82,6 +82,7 @@ Allowed values are as follows:
|
|||
- `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk)
|
||||
- `chunksSortMode`: Allows to control how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'auto' | 'dependency' | {function} - default: 'auto'
|
||||
- `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`
|
||||
|
||||
Here's an example webpack config illustrating how to use these options:
|
||||
```javascript
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
new HtmlWebpackPlugin(),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
}, ['<link href="styles.css"'], null, done);
|
||||
}, ['<link href="styles.css" rel="stylesheet">'], null, done);
|
||||
});
|
||||
|
||||
it('should work with the css extract plugin on windows and protocol relative urls support (#205)', function (done) {
|
||||
|
|
@ -478,6 +478,26 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}, ['<link href="styles.css?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('should output xhtml link stylesheet tag', function (done) {
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/theme.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({xhtml: true}),
|
||||
new ExtractTextPlugin('styles.css')
|
||||
]
|
||||
}, ['<link href="styles.css" rel="stylesheet"/>'], null, done);
|
||||
});
|
||||
|
||||
it('prepends the webpack public path to script src', function (done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
|
|
@ -893,6 +913,23 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}, [/<link rel="shortcut icon" href="[^"]+\.ico">/], null, done);
|
||||
});
|
||||
|
||||
it('adds a favicon with xhtml enabled', function (done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
xhtml: true,
|
||||
favicon: path.join(__dirname, 'fixtures/favicon.ico')
|
||||
})
|
||||
]
|
||||
}, [/<link rel="shortcut icon" href="[^"]+\.ico"\/>/], null, done);
|
||||
});
|
||||
|
||||
it('shows an error if the favicon could not be load', function (done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue