A static site building framework giving high speed performance and a modernized development flow. Astro converts your website source code to static HTML during the building process, resulting in an almost fully static website with minimal JavaScript leftover. This results in maximized speed for loading content from the web browser.
Questions tagged [astrojs]
196 questions
2
votes
1 answer
Astro JS + Tailwind / Classes From Typescript not getting Included
I'm trying to build out a single static component in Astro.build that has previously been built in Svelte, but I'm not sure I have my environment properly setup. I have an imported TS file that returns an object with my tailwind classes. Essentially…

user10012
- 647
- 1
- 8
- 23
2
votes
1 answer
How can I access the url query parameters from an Astro file (server side)?
I'm unable to access the query parameters of an astro file.
Given the url http://localhost:3000/example?hello=meow:
How can I access {hello: "meow"} from within the example.astro file?

ThomasReggi
- 55,053
- 85
- 237
- 424
2
votes
1 answer
Astro: Access nano store hook "useStore" from a *.astro file
I've defined a nano store in src/themeStore.ts:
import { atom } from 'nanostores';
export const theme = atom('blue');
I'm trying to access the store's value in the front-matter of an *.astro file.
src/pages/samples/[id].astro:
import { useStore }…

Jonathan.Brink
- 23,757
- 20
- 73
- 115
2
votes
1 answer
Is it possible to enable Official Tailwind Plugins?
How to enable Official Tailwind Plugins while using astrojs/tailwind?
I have installed the typography plugin, restarted the server, and refreshed the browser. But I still have a small H1 heading.
npm install -D @tailwindcss/typography ➡
Then I've…

Cem Kaan
- 2,086
- 1
- 24
- 55
2
votes
3 answers
Getting error when importing fontawesome icons
I'm trying to build a simple website using Astro, it runs perfectly fine when using astro dev but I can't build the website using astro build because this happens:
The error I'm getting:
error Named export 'faGithub' not found. The requested…

Uri
- 31
- 6
2
votes
1 answer
Astro Js @font-face import build wrong replacement
I'm building an Astro Js project, I wan't to import a css file (for icons) from a dependency which include their own font files :
// @icons/dist/.../index.css
@font-face {
font-family: "font name";
src: url("./icons.ttf")…

JuleZ
- 216
- 3
- 11
2
votes
1 answer
I want to import bootstrap js and jquery js file in astro js
I tried ES imports statements and normal script tag to import the required JS file and CSS file for bootstrap in astro js project
I am getting this Issue.
Error: The following dependencies are imported but could not…

Abdeali Chandanwala
- 8,449
- 6
- 31
- 45
1
vote
1 answer
Astro: How do I call a function inside the script from onclick in a button?
Here is my example. How to call greeting() function from the button? Please help me, thanks!
---
import Layout from "@layouts/Layout.astro";
const greeting = () => {
console.log("Hello, server");
};
---

Thuong Vu
- 53
- 1
- 7
1
vote
1 answer
Astro 9.5.1 - routing to markdown files does shows page not found
---
// component imports
import MainLayout from "../../layouts/MainLayout.astro";
---
1
vote
1 answer
Tailwind & PostCSS error when adding Svelte to an Astro project
I have been using Astro with Tailwind for a project, however upon adding Svelte to the project with a simple npx astro add svelte, a simple npm run dev produces this error:
error Cannot read properties of undefined (reading 'postcss')
File:
…

Dhruv
- 328
- 3
- 7
1
vote
1 answer
Custom components in Markdown / MDX on Astro
I would like to be able to replace the default code that Astro uses to render some Markdown elements.
For example, it would be nice that when I type :
Some Text

---
Some other text
I could get
Some Text

TOOL
- 70
- 1
- 10
1
vote
1 answer
Tailwind lg breakpoint not working after deploy but fine locally
When running my current Astro.build project locally using astro dev, styling works as expected.
After building and deploying the site though – either with astro build and astro preview or live on cloudflare pages – the lg breakpoint does not…

J Heschl
- 177
- 4
- 15
1
vote
1 answer
Convert markdown to HTML in Astro
How can I convert markdown to HTML within Astro? If you import an MD file within Astro, the content will automatically be converted to HTML in the background.
But I use Strapi as my CMS system. I fetch my posts with the fetch() method, and that…

Remco Kersten
- 146
- 8
1
vote
2 answers
How do I use SVGs in AstroJS?
Going to their Docs @ AstroDocs
Astro.js Example
import imgReference from './image.png'; // imgReference === '/src/image.png'
import svgReference from './image.svg'; // svgReference === '/src/image.svg'
import txtReference from './words.txt'; //…

ZuesSSSSS
- 21
- 3
1
vote
1 answer
Does Astro js fallback to SSR when cache is not available?
In Next js , when the cache is not available , Next js is going to SSR the page and show it (based on the prefered fallback approach true or blocking) .
I Wonder what approach does Astro js takes in this scenario .I'm going to create a dynamic blog…

Moein Moeinnia
- 1,945
- 3
- 10
- 26