@@ -442,11 +442,12 @@ function prettierEmbeddedContent(node, level, indent, prettierOpts) {
442442 const isStyleTag = isElement ( node , 'style' )
443443 const isScriptTag = isElement ( node , 'script' )
444444 let content = toString ( node )
445+ let type = node . properties . type ? `type="${ node . properties . type } "` : ''
445446
446447 if ( isScriptTag ) {
447- content = ' <script>' + content + ' </script>'
448+ content = ` <script ${ type } > ${ content } </script>`
448449 } else if ( isStyleTag ) {
449- content = ' <style>' + content + ' </style>'
450+ content = ` <style ${ type } > ${ content } </style>`
450451 }
451452
452453 let formattedText = prettier . format (
@@ -458,12 +459,12 @@ function prettierEmbeddedContent(node, level, indent, prettierOpts) {
458459
459460 if ( isScriptTag ) {
460461 formattedText = formattedText
461- . replace ( / \n * < \/ s c r i p t \s * > / g , '' )
462- . replace ( / < s c r i p t \s * > \n * / g , '' )
462+ . replace ( / \n * < \/ s c r i p t \s * > / , '' )
463+ . replace ( / < s c r i p t . * > \n * / , '' )
463464 } else if ( isStyleTag ) {
464465 formattedText = formattedText
465- . replace ( / \n * < \/ s t y l e \s * > / g , '' )
466- . replace ( / < s t y l e \s * > \n * / g , '' )
466+ . replace ( / \n * < \/ s t y l e \s * > / , '' )
467+ . replace ( / < s t y l e . * > \n * / , '' )
467468 }
468469
469470 node . children = [
0 commit comments