Skip to content

Commit

Permalink
feat: Remove selfClosingTag
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove selfClosingTag attribute
  • Loading branch information
jantimon committed Jun 3, 2018
1 parent 6ae6f48 commit 5d3d8e4
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions index.js
Expand Up @@ -517,21 +517,19 @@ class HtmlWebpackPlugin {
// Make tags self-closing in case of xhtml
// Turn { "viewport" : "width=500, initial-scale=1" } into
// [{ name:"viewport" content:"width=500, initial-scale=1" }]
const selfClosingTag = !!this.options.xhtml;
const metaTagAttributeObjects = Object.keys(this.options.meta).map((metaName) => {
const metaTagContent = this.options.meta[metaName];
return (typeof metaTagContent === 'object') ? metaTagContent : {
const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
const metaTagContent = metaOptions[metaName];
return (typeof metaTagContent === 'string') ? {
name: metaName,
content: metaTagContent
};
} : metaTagContent;
});
// Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
// the html-webpack-plugin tag structure
return metaTagAttributeObjects.map((metaTagAttributes) => {
return {
tagName: 'meta',
voidTag: true,
selfClosingTag: selfClosingTag,
attributes: metaTagAttributes
};
});
Expand All @@ -552,22 +550,19 @@ class HtmlWebpackPlugin {
body: HtmlTagObject[]
}}
*/
generateHtmlTags (assets) {
generateHtmlTagObjects (assets) {
// Turn script files into script tags
const scripts = assets.js.map(scriptPath => ({
tagName: 'script',
closeTag: true,
voidTag: false,
attributes: {
type: 'text/javascript',
src: scriptPath
}
}));
// Make tags self-closing in case of xhtml
const selfClosingTag = !!this.options.xhtml;
// Turn css files into link tags
const styles = assets.css.map(stylePath => ({
tagName: 'link',
selfClosingTag: selfClosingTag,
voidTag: true,
attributes: {
href: stylePath,
Expand All @@ -582,7 +577,6 @@ class HtmlWebpackPlugin {
if (assets.favicon) {
head.push({
tagName: 'link',
selfClosingTag: selfClosingTag,
voidTag: true,
attributes: {
rel: 'shortcut icon',
Expand Down

0 comments on commit 5d3d8e4

Please sign in to comment.