diff --git a/src/generators/dom/index.ts b/src/generators/dom/index.ts index 096fe30307..6306645fa7 100644 --- a/src/generators/dom/index.ts +++ b/src/generators/dom/index.ts @@ -222,7 +222,7 @@ export default function dom( this._yield = options._yield; this._torndown = false; - ${parsed.css && + ${generator.css && options.css !== false && `if ( !document.getElementById( ${JSON.stringify( generator.cssId + '-style' diff --git a/src/utils/deindent.ts b/src/utils/deindent.ts index 13278b26b1..5f42e89604 100644 --- a/src/utils/deindent.ts +++ b/src/utils/deindent.ts @@ -1,6 +1,6 @@ const start = /\n(\t+)/; -export default function deindent(strings: string[], ...values: any[]) { +export default function deindent(strings: TemplateStringsArray, ...values: any[]) { const indentation = start.exec(strings[0])[1]; const pattern = new RegExp(`^${indentation}`, 'gm'); diff --git a/test/runtime/samples/empty-style-block/_config.js b/test/runtime/samples/empty-style-block/_config.js new file mode 100644 index 0000000000..0375bad029 --- /dev/null +++ b/test/runtime/samples/empty-style-block/_config.js @@ -0,0 +1,3 @@ +export default { + html: '', +}; diff --git a/test/runtime/samples/empty-style-block/main.html b/test/runtime/samples/empty-style-block/main.html new file mode 100644 index 0000000000..6f29e9e9f9 --- /dev/null +++ b/test/runtime/samples/empty-style-block/main.html @@ -0,0 +1 @@ +