add support for css @import rules (#11)

This commit is contained in:
Whalefreezer
2026-04-01 12:00:00 +08:00
committed by yz-yu
parent fe59f07e9e
commit 68b97e40a2
4 changed files with 37 additions and 1 deletions

View File

@@ -205,3 +205,14 @@ exports[`[html file]: with-style-sheet.html 1`] = `
</head><body>
</body></html>"
`;
exports[`[html file]: with-style-sheet-with-import.html 1`] = `
"<!DOCTYPE html><html xmlns=\\"http://www.w3.org/1999/xhtml\\" lang=\\"en\\"><head>
<meta charset=\\"UTF-8\\" />
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\" />
<meta http-equiv=\\"X-UA-Compatible\\" content=\\"ie=edge\\" />
<title>with style sheet with import</title>
<style>body { margin: 0px; background: url('http://localhost:3030/a.jpg'); }p { color: red; background: url('http://localhost:3030/css/b.jpg'); }body &gt; p { color: yellow; }</style>
</head><body>
</body></html>"
`;

1
test/css/style-with-import.css vendored Normal file
View File

@@ -0,0 +1 @@
@import "./style.css";

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>with style sheet with import</title>
<link rel="stylesheet" href="/css/style-with-import.css">
</head>
<body>
</body>
</html>