Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Snippets AstroNew to Visual Studio Code? Get it now.
Snippets Astro

Snippets Astro

Preview

Gohit X

|
256 installs
| (1) | Free
| Sponsor
Available now: VSCode • Cursor • Windsurf • Trae.ai • Kiro & (Firebase Studio)... 雨
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Use Extension

Version  Rating  Downloads  Github Star ⭐️


🚀 Main Snippets

🧩 Snippet 🆎 Prefix ⚡ Quick Shortcut
Main Page a-main amain
Layout Component a-layout al
Import Layout a-import-layout ail
Import Layout Tailwind a-import-layout-tailwind ailt
Page with getStaticPaths a-page-gsp apgsp
Content Collections Page a-page-collection apc

🚀 Basic Snippets

🧩 Snippet 🆎 Prefix ⚡ Quick Shortcut
Astro Component a-component acomp
Get Static Paths a-gsp agsp
Astro Glob a-glob aglob
Get Collection a-collection acoll
Astro Named Slot a-slot-named asn
Astro Style a-style astyle
Astro Script a-script ascript
Style & Script a-style-script ass
Fragment Named Slot a-fragment-slot afs

🔀 Expressions and Logic

🧩 Snippet 🆎 Prefix ⚡ Quick Shortcut
Map Expression a-map amap
Ternary Expression a-ternary aternary
- - -
Astro Image Import a-img aimg
Astro Image Tag a-image aimage

🎨 Styles

🧩 Snippet 🆎 Prefix ⚡ Quick Shortcut
Global CSS a-global-css agcss

🚀 How to Use

  1. Open a .astro or .css file.
  2. Type any Quick Shortcut or Prefix (e.g., al for Layout or agcss for Global CSS).
  3. Press Tab or Enter to expand the snippet.
📖 Usage Guide

🎯 Basic Components

  • a-component: Component with TypeScript and prop interfaces
  • a-gsp: Static route generation with getStaticPaths
  • a-collection: Get content collection with Astro Content Collections

🏗️ Layouts and Structures

  • a-layout: Full layout component with SEO and dark mode support
  • a-import-layout: Import layout component with basic structure
  • a-import-layout-tailwind: Import layout with Tailwind CSS classes
  • a-main: Complete main page with layout, styles, and scripts

🎨 Styles

  • a-global-css: Global CSS with CSS variables, dark mode, and Tailwind import
  • a-style: Astro style tag
  • a-style-script: Combined style and script tags with markers

🔄 Dynamic Rendering

  • a-map: List rendering with .map()
  • a-ternary: Conditional rendering with ternary operator

🖼️ Images

  • a-img: Import Astro Image component
  • a-image: Optimized image tag with width and height

📝 Content Collections

  • a-page-collection: Dynamic page for content collections with rendering

🚀 Quick Start

  1. Basic Component: Type a-component + Tab to create a component with props
  2. Full Layout: Type a-layout + Tab for a complete layout with SEO
  3. Main Page: Type a-main + Tab for a complete page structure
  4. Global Styles: Type a-global-css + Tab for global CSS with dark mode

💡 Pro Tips

  • Always use TypeScript: Snippets automatically include prop interfaces
  • Dark Mode Ready: Use a-global-css for automatic dark mode support
  • Optimize Images: Use a-image instead of simple <img> tags
  • Content Collections: Use a-collection for type-safe content management

🧩 Extension Commands [ + ]

This extension includes several commands to help you manage your snippets efficiently. You can access these commands by pressing Ctrl+Shift+P (or Cmd+Shift+P on macOS).

Main Commands:

  • 🛠️ Astrojs: Manage Snippets - Central hub to edit, delete, refresh, reset, and create snippets
  • ✍️ Astrojs: Create New Snippet - Create a new custom snippet file for any language
  • 🔄 Astrojs: Refresh Snippets - Reload snippets to reflect recent changes

Additional Commands:

  • 📄 Astrojs: Open Snippet File - Open a snippet file for editing
  • ♻️ Astrojs: Reset Snippet to Original - Restore default snippet from extension
  • 🗑️ Astrojs: Delete Custom Snippet - Remove a custom snippet file

Installation

Launch Quick Open

  • Linux Ctrl+P
  • macOS ⌘P
  • Windows Ctrl+P

Paste the following command and press Enter:

ext install bastndev.astro-js-snippets

About Me

gohitx
Gohit X
Creator & Maintainer
  • 🐦 X - For questions and discussions.
  • 🔴 Youtube - Code, Software and development insights.
  • 💼 Linkedin - Professional networking and career updates.

Icon Name Description
Lynx Theme Pro Lynx Theme Pro A professional extension with six available themes: Dark, Light, Night, Ghibli, Coffee, and Kiro—with integrated icons. Each theme is optimized to offer a more pleasant visual experience.
Bracket Lynx Bracket Lynx Enhances the development experience by displaying a label next to each closing parenthesis, indicating the name of the corresponding block or function, along with the start and end line numbers.
Lynx Keymap Pro Lynx Keymap Pro Standardizes keyboard shortcuts across all code editors, allowing you to use key combinations to access any functionality. It improves workflow and development experience.

Ready! 🚀 Your (Snippets Astro) are configured.
If you find any bugs or have feedback, you can open an issue.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft