diff --git a/packages/astro/src/compiler/transform/doctype.ts b/packages/astro/src/compiler/transform/doctype.ts index 1a0ff39e1..7647c205e 100644 --- a/packages/astro/src/compiler/transform/doctype.ts +++ b/packages/astro/src/compiler/transform/doctype.ts @@ -9,7 +9,7 @@ export default function (_opts: { filename: string; fileID: string }): Transform html: { Element: { enter(node, parent, _key, index) { - if (node.name === '!doctype') { + if (node.name.toLowerCase() === '!doctype') { hasDoctype = true; } if (node.name === 'html' && !hasDoctype) { diff --git a/packages/astro/src/compiler/transform/postcss-scoped-styles/index.ts b/packages/astro/src/compiler/transform/postcss-scoped-styles/index.ts index 63ac9fd8d..7db630764 100644 --- a/packages/astro/src/compiler/transform/postcss-scoped-styles/index.ts +++ b/packages/astro/src/compiler/transform/postcss-scoped-styles/index.ts @@ -28,8 +28,7 @@ export const NEVER_SCOPED_TAGS = new Set([ 'noscript', 'script', 'style', - 'title', - '!doctype', + 'title' ]); /** * Scope Rules diff --git a/packages/astro/src/compiler/transform/styles.ts b/packages/astro/src/compiler/transform/styles.ts index 1e459bb7f..e1199e9a6 100644 --- a/packages/astro/src/compiler/transform/styles.ts +++ b/packages/astro/src/compiler/transform/styles.ts @@ -4,13 +4,12 @@ import type { TemplateNode } from '@astrojs/parser'; import crypto from 'crypto'; import { createRequire } from 'module'; import path from 'path'; -import { fileURLToPath } from 'url'; import autoprefixer from 'autoprefixer'; import postcss, { Plugin } from 'postcss'; import postcssKeyframes from 'postcss-icss-keyframes'; import findUp from 'find-up'; import sass from 'sass'; -import { debug, error, LogOptions } from '../../logger.js'; +import { error, LogOptions } from '../../logger.js'; import astroScopedStyles, { NEVER_SCOPED_TAGS } from './postcss-scoped-styles/index.js'; import slash from 'slash'; @@ -222,7 +221,9 @@ export default function transformStyles({ compileOptions, filename, fileID }: Tr } // 2. add scoped HTML classes - if (NEVER_SCOPED_TAGS.has(node.name)) return; // only continue if this is NOT a