Skip to content

Commit 5d3d8e4

Browse files
committedJun 3, 2018
feat: Remove selfClosingTag
BREAKING CHANGE: Remove selfClosingTag attribute
1 parent 6ae6f48 commit 5d3d8e4

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed
 

‎index.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,19 @@ class HtmlWebpackPlugin {
517517
// Make tags self-closing in case of xhtml
518518
// Turn { "viewport" : "width=500, initial-scale=1" } into
519519
// [{ name:"viewport" content:"width=500, initial-scale=1" }]
520-
const selfClosingTag = !!this.options.xhtml;
521-
const metaTagAttributeObjects = Object.keys(this.options.meta).map((metaName) => {
522-
const metaTagContent = this.options.meta[metaName];
523-
return (typeof metaTagContent === 'object') ? metaTagContent : {
520+
const metaTagAttributeObjects = Object.keys(metaOptions).map((metaName) => {
521+
const metaTagContent = metaOptions[metaName];
522+
return (typeof metaTagContent === 'string') ? {
524523
name: metaName,
525524
content: metaTagContent
526-
};
525+
} : metaTagContent;
527526
});
528527
// Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
529528
// the html-webpack-plugin tag structure
530529
return metaTagAttributeObjects.map((metaTagAttributes) => {
531530
return {
532531
tagName: 'meta',
533532
voidTag: true,
534-
selfClosingTag: selfClosingTag,
535533
attributes: metaTagAttributes
536534
};
537535
});
@@ -552,22 +550,19 @@ class HtmlWebpackPlugin {
552550
body: HtmlTagObject[]
553551
}}
554552
*/
555-
generateHtmlTags (assets) {
553+
generateHtmlTagObjects (assets) {
556554
// Turn script files into script tags
557555
const scripts = assets.js.map(scriptPath => ({
558556
tagName: 'script',
559-
closeTag: true,
557+
voidTag: false,
560558
attributes: {
561559
type: 'text/javascript',
562560
src: scriptPath
563561
}
564562
}));
565-
// Make tags self-closing in case of xhtml
566-
const selfClosingTag = !!this.options.xhtml;
567563
// Turn css files into link tags
568564
const styles = assets.css.map(stylePath => ({
569565
tagName: 'link',
570-
selfClosingTag: selfClosingTag,
571566
voidTag: true,
572567
attributes: {
573568
href: stylePath,
@@ -582,7 +577,6 @@ class HtmlWebpackPlugin {
582577
if (assets.favicon) {
583578
head.push({
584579
tagName: 'link',
585-
selfClosingTag: selfClosingTag,
586580
voidTag: true,
587581
attributes: {
588582
rel: 'shortcut icon',

0 commit comments

Comments
 (0)
Please sign in to comment.