-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude any ?raw or ?url css imports when adding asset links (#3020)
* exclude any ?raw css imports when adding css asset links * ?url imports should be ignored as well * chore: adding changeset
- Loading branch information
Tony Sullivan
authored
Apr 7, 2022
1 parent
c757427
commit c773dcd
Showing
6 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Add support for advanced CSS imports with `?raw` and `?url` | ||
|
||
> ⚠️WARNING⚠️: | ||
> Be careful when bypassing Astro's built-in CSS bundling! Styles won't be included in the built output - this is best used in combination with `set:html` to inline styles directly into the built HTML page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/astro/test/fixtures/astro-css-bundling-import/src/layouts/InlineLayout.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
import "../styles/site.css" | ||
const {title} = Astro.props; | ||
--- | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title>{title}</title> | ||
</head> | ||
|
||
<body> | ||
<ul> | ||
<li><a href="/page-1">Page 1</a></li> | ||
<li><a href="/page-2">Page 2</a></li> | ||
<li><a href="/page-3">Page 3</a></li> | ||
<!-- <li><a href="/page-2-reduced-layout">Page 2 reduced layout</a></li> --> | ||
</ul> | ||
<main id="page"> | ||
<slot></slot> | ||
</main> | ||
</body> | ||
|
||
</html> |
12 changes: 12 additions & 0 deletions
12
packages/astro/test/fixtures/astro-css-bundling-import/src/pages/page-3.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
import PageLayout from "../layouts/InlineLayout.astro" | ||
import styles from "../styles/page-three.css?raw" | ||
import stylesUrl from "../styles/page-one.css?url" | ||
--- | ||
|
||
<PageLayout title="Page 3"> | ||
<style set:html={styles}></style> | ||
|
||
<h1>Page 3</h1> | ||
<p>This text should be purple, because we want the inlined <code>page-3.css</code> to override <code>site.css</code></p> | ||
</PageLayout> |
3 changes: 3 additions & 0 deletions
3
packages/astro/test/fixtures/astro-css-bundling-import/src/styles/page-three.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
p { | ||
color: purple; | ||
} |