Does anyone know how I'll be able to import my external CSS and JS files into Astro's new version? I tried:
<link rel="stylesheet" href={Astro.resolve('../styles/style.css')}>
But it's not workings anymore after Astro's new 1.0 Update launch.
Astro.resolve
has been deprecated as you can see in detail in the documentation .
Summary of the recommended ESM Import method:
.css
file inside the src/
directory.astro
file:---
// Example: Astro will include and optimize this CSS for you automatically
import './style.css';
---
<html><!-- Your page here --></html>
If you place your style sheet in the public
folder, you can simply import it using:
<link rel="stylesheet" href="index.css" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.