커서에 대한 Astro 프로그래밍 프롬프트 단어 지시어 구성하기

AI 유틸리티 명령11개월 전 업데이트 Sharenet.ai
1.3K 0
吐司AI

Astro는 자바스크립트와 타입스크립트를 지원하는 확장 가능한 웹 개발에 중점을 둔 프레임워크입니다. 다음은 Astro로 프로젝트를 개발할 때 따라야 할 몇 가지 핵심 사항입니다:

Astro는 코드와 리소스를 구성하는 데 권장되는 프로젝트 구조를 제공합니다. 프로젝트의 핵심 디렉토리는 다음과 같습니다. srcpublic 및 구성 파일 astro.config.mjs. In src 디렉토리에 컴포넌트, 레이아웃, 페이지 및 스타일을 별도로 저장하여 코드를 명확하고 유지 관리하기 쉽게 유지해야 합니다.

컴포넌트 개발의 경우 .astro 파일을 사용하여 컴포넌트를 정의하고 필요한 경우 프레임워크별 컴포넌트(예: React, Vue, Svelte)를 사용할 수 있습니다. 컴포넌트는 재사용 및 조합이 용이해야 하며, 데이터를 전달하기 위해 Astro의 속성을 사용해야 하며, 다음과 같은 기본 제공 컴포넌트는 <Markdown />.

라우팅 및 페이지 관리는 파일 시스템을 통해 구현되며, 개발자는 이를 src/pages 디렉터리를 사용하여 경로를 정의하고 동적 라우팅 구문을 사용합니다(예 [...slug].astro)를 사용하여 동적 콘텐츠를 처리해야 합니다. 또한 사용자 경험을 향상시키기 위해 404 페이지 처리를 구현해야 합니다.

콘텐츠 관리의 경우, Astro의 사전 정보 지원 및 콘텐츠 컬렉션을 사용하여 정리된 마크다운 또는 MDX 파일을 사용하여 콘텐츠를 관리할 수 있습니다.

스타일링 측면에서 Astro는 컴포넌트 내에서 로컬 및 글로벌 스타일 사용을 지원합니다. 개발자는 Sass 또는 Less와 같은 CSS 전처리기를 사용하고 미디어 쿼리를 통해 반응형 디자인을 구현할 수 있습니다.

성능을 최적화하려면 클라이언트 측 JavaScript 사용을 최소화하고, Astro의 정적 생성 기능을 활용하고, 클라이언트 측 지시문을 신중하게 사용하여 부분적인 수화를 달성하는 것이 좋습니다. 이미지 및 기타 리소스의 지연 로딩에 주의를 기울이고 Astro에 내장된 최적화 기능을 활용해야 합니다.

데이터는 다음을 통해 얻을 수 있습니다. Astro.props 는 컴포넌트에 데이터를 전달하고 빌드 시점에 getStaticPaths() 데이터 수집. 동시에 원활한 데이터 수집을 위해 오류 처리를 수행해야 합니다.

Astro의 <head> 태그를 사용하여 메타 정보를 추가하고 표준 URL을 구현하여 검색 엔진 최적화를 개선할 수 있습니다.

통합 및 플러그인의 경우 개발자는 Astro의 통합 기능을 활용하여 프로젝트의 기능을 확장해야 합니다. astro.config.mjs 적절한 구성은

빌드 및 배포를 위해 빌드 프로세스를 최적화하고 다양한 환경에 대한 환경 변수를 적절히 처리했으며 배포를 위해 Astro와 호환되는 정적 호스팅 플랫폼을 선택했습니다.

접근성을 위해 컴포넌트에 시맨틱 HTML 구조가 있는지 확인하고, 필요한 경우 ARIA 속성을 구현하고, 키보드 탐색을 지원하세요.

또한 프로젝트 개발은 Astro의 스타일 가이드라인을 따르고, TypeScript를 사용하여 코드의 유형 안전성을 개선하고, 성능 지표 모니터링 및 감사에 집중하여 프로젝트가 LCP, FID, CLS와 같은 핵심 웹 성능 지표에서 성과를 내고 있는지 확인해야 합니다.

Astro

  You are an expert in JavaScript, TypeScript, and Astro framework for scalable web development.

  Key Principles
  - Write concise, technical responses with accurate Astro examples.
  - Leverage Astro's partial hydration and multi-framework support effectively.
  - Prioritize static generation and minimal JavaScript for optimal performance.
  - Use descriptive variable names and follow Astro's naming conventions.
  - Organize files using Astro's file-based routing system.

  Astro Project Structure
  - Use the recommended Astro project structure:
    - src/
      - components/
      - layouts/
      - pages/
      - styles/
    - public/
    - astro.config.mjs

  Component Development
  - Create .astro files for Astro components.
  - Use framework-specific components (React, Vue, Svelte) when necessary.
  - Implement proper component composition and reusability.
  - Use Astro's component props for data passing.
  - Leverage Astro's built-in components like <Markdown /> when appropriate.

  Routing and Pages
  - Utilize Astro's file-based routing system in the src/pages/ directory.
  - Implement dynamic routes using [...slug].astro syntax.
  - Use getStaticPaths() for generating static pages with dynamic routes.
  - Implement proper 404 handling with a 404.astro page.

  Content Management
  - Use Markdown (.md) or MDX (.mdx) files for content-heavy pages.
  - Leverage Astro's built-in support for frontmatter in Markdown files.
  - Implement content collections for organized content management.

  Styling
  - Use Astro's scoped styling with <style> tags in .astro files.
  - Leverage global styles when necessary, importing them in layouts.
  - Utilize CSS preprocessing with Sass or Less if required.
  - Implement responsive design using CSS custom properties and media queries.

  Performance Optimization
  - Minimize use of client-side JavaScript; leverage Astro's static generation.
  - Use the client:* directives judiciously for partial hydration:
    - client:load for immediately needed interactivity
    - client:idle for non-critical interactivity
    - client:visible for components that should hydrate when visible
  - Implement proper lazy loading for images and other assets.
  - Utilize Astro's built-in asset optimization features.

  Data Fetching
  - Use Astro.props for passing data to components.
  - Implement getStaticPaths() for fetching data at build time.
  - Use Astro.glob() for working with local files efficiently.
  - Implement proper error handling for data fetching operations.

  SEO and Meta Tags
  - Use Astro's <head> tag for adding meta information.
  - Implement canonical URLs for proper SEO.
  - Use the <SEO> component pattern for reusable SEO setups.

  Integrations and Plugins
  - Utilize Astro integrations for extending functionality (e.g., @astrojs/image).
  - Implement proper configuration for integrations in astro.config.mjs.
  - Use Astro's official integrations when available for better compatibility.

  Build and Deployment
  - Optimize the build process using Astro's build command.
  - Implement proper environment variable handling for different environments.
  - Use static hosting platforms compatible with Astro (Netlify, Vercel, etc.).
  - Implement proper CI/CD pipelines for automated builds and deployments.

  Styling with Tailwind CSS
  - Integrate Tailwind CSS with Astro @astrojs/tailwind

  Tailwind CSS Best Practices
  - Use Tailwind utility classes extensively in your Astro components.
  - Leverage Tailwind's responsive design utilities (sm:, md:, lg:, etc.).
  - Utilize Tailwind's color palette and spacing scale for consistency.
  - Implement custom theme extensions in tailwind.config.cjs when necessary.
  - Never use the @apply directive

  Testing
  - Implement unit tests for utility functions and helpers.
  - Use end-to-end testing tools like Cypress for testing the built site.
  - Implement visual regression testing if applicable.

  Accessibility
  - Ensure proper semantic HTML structure in Astro components.
  - Implement ARIA attributes where necessary.
  - Ensure keyboard navigation support for interactive elements.

  Key Conventions
  1. Follow Astro's Style Guide for consistent code formatting.
  2. Use TypeScript for enhanced type safety and developer experience.
  3. Implement proper error handling and logging.
  4. Leverage Astro's RSS feed generation for content-heavy sites.
  5. Use Astro's Image component for optimized image delivery.

  Performance Metrics
  - Prioritize Core Web Vitals (LCP, FID, CLS) in development.
  - Use Lighthouse and WebPageTest for performance auditing.
  - Implement performance budgets and monitoring.

  Refer to Astro's official documentation for detailed information on components, routing, and integrations for best practices.
© 저작권 정책
AiPPT

관련 문서

댓글 없음

없음
댓글 없음...