Questions tagged [astro]

Astro is an all-in-one web framework for building fast, content-focused websites. More info can be found here: https://astro.build/

Astro is an all-in-one web framework for building fast, content-focused websites.
More info can be found here: https://astro.build/

252 questions
1
vote
1 answer

Dynamically import/use images from collection markdown with Astro assets?

As an example, I have an Astro app with a collection /collections/artworks where each artwork specifices a cover image via the frontmatter cover: '../assets/artworks/1-hello/cover.png - the file lies at /src/assets/artworks/1-hello/cover.png. I am…
waffl
  • 5,179
  • 10
  • 73
  • 123
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
0 answers

How can I solve 'Element type is invalid' error when running Astro build with React components?

Tried running astro build in my astro project with a few react components but got this error Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. File: …
1
vote
0 answers

How to access the markdown files stored in the second repository in the Astro framework

How to access the markdown files stored in the second repository in the Astro framework. I am working on a website that is built using the Astro framework. Below is the function glob which returns an array of posts that are live at…
Anurag Verma
  • 121
  • 7
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

Type issue of ref using EmailJS and Typescript

I'm new to React and I use the Astro framework. I would like to add a contact form to my landing page and to do so I use the EmailJS service. I tried to get the example in documentation of EmailJS for React and adapt it to Typescript but I can't…
Collembole
  • 158
  • 2
  • 13
1
vote
0 answers

Astro JS site builder: Include worker (or other companion library) in build

I'm building a web app that relies heavily on a background Worker Background workers are essentially little companion libraries that you write that are loaded separately from the rest of the application JS. Here's how I successfully load a worker in…
chadoh
  • 4,343
  • 6
  • 39
  • 64
1
vote
1 answer

How to fetch data from your own server using Astro?

I have created a NodeJS server with Express and a frontend with Astro with SSR configured with the Astro adapter for NodeJS. Now, I am trying to fetch data from the backend, and I don't know how to do it. Here is the fetch request on the…
1
vote
0 answers

Rendering 3D-models with Astro suffers from performance issues

I made an interactive 3D car showcase with Astro for my bachelors thesis. It's currently suffering from performance issues. I work with some downloaded 3D-models that are high quality and selfmade lowpoly 3D-models. The lowpoly ones still need 2 sec…
Laura
  • 11
  • 3
1
vote
1 answer

How to center elements on navbar | SCSS with Astro

My SCSS isn't working correctly. It should center the links of the navbar component I'm trying to make and not the logo. The css doesn't center them both. image The following code is my css (SCSS): .navbar { background-color: black; display:…
Mart
  • 11
  • 3
1
vote
1 answer

What is the correct way of importing local json file to another file using astro?

I have build a website that is a cook book. I want to store recipies as data in one json file. What is the right code to import parts of that json file in to another file (fx starters.astro) So to specyfy my question(s): Where do I store my json…
Kesse
  • 11
  • 1
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…
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

How to access clientAddress in Astro api routes?

I know that we can access user's IP address in Astro using Astro.clientAddress value but this would only work in .astro pages. // your-ip.astro --- const detectedIp = Astro.clientAddress; ---

Your IP: {{ detectedIP }}

but in my case, I…
Visrut
  • 360
  • 4
  • 14
1
vote
0 answers

Unable to Import MD Files in Astro When Built, but Works During npm run dev

Currently, I'm trying to import MD files in Astro using the following code: import * as a from '../content/a.md'; This code works perfectly fine when I'm running "npm run dev", but it throws an error during build as follows: Assigning to rvalue…
yir
  • 11
  • 1
1 2
3
16 17