Albert26193 / web-learning-playground

A demo environment that integrates multiple mainstream front-end frameworks, making it easy to learn multiple frameworks in one environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web-Learning-Playground

Intro

  • A demo environment that integrates multiple mainstream front-end frameworks, making it easy to learn multiple frameworks in one environment. 🍺️
  • Based on Astro, a new static site builder that combines the best parts of modern build tools and frameworks.
  • Integrated with TailwindCSS FrameWork with TailwindCSS Framework to Reduce the difficulty of writing styles.
  • Use Prettier to lint code style.

Preview

  • OverView:

overview

  • React Preview:

react

Get Start

# 0. clone this repo
git clone https://github.com/Albert26193/web-learning-playground.git

# 1. install dependencies
pnpm install

# 2. start dev server
pnpm dev

Project Structure

Inside of this project, you'll see the following folders and files: πŸš€

/
β”œβ”€β”€ public/
β”‚   └── favicon.svg
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ .../
β”‚   β”‚   └── ....astro
β”‚   └── pages/
β”‚       └── index.astro
└── package.json
  • The learning content is centrally located in the /src/pages directory, which is a crucial directory.
  • Astro looks for .astro files in the src/pages/ directory. Each page is exposed as a route based on its file name.
  • Any static assets, like images, can be placed in the public/ directory.

  • /src/pages structure:
# /src/pages
.
β”œβ”€β”€ index.astro
β”œβ”€β”€ React
β”‚   β”œβ”€β”€ Demo
β”‚   β”œβ”€β”€ Game
β”‚   └── Router.astro   # React Router
β”œβ”€β”€ Vanilla
β”‚   β”œβ”€β”€ Demo
β”‚   └── Router.astro  # Vanilla Router
└── Vue
    β”œβ”€β”€ Demo
    β”œβ”€β”€ TestSlot
    └── Router.astro     # Vue Router

Usage

  • For example, I want to create a React learning demo, which named demo.
  • step1: add a new dir named Demo in /src/pages/React/.
  • step2: add a new file named [your file name].tsx in /src/pages/React/Demo/ (the tsx is the file extension of React), then write your React code in [your file name].tsx.
  • step3: add a new Astro file Named index.astro, which offers a route. The content of index.astro is as follows:
---
import { DemoReact } from '[your file name]';
import LayoutReact from '../../../layouts/LayoutReact.astro';
---

<LayoutReact title="react demo" framework="React">
  <DemoReact client:load />
</LayoutReact>

  • after that, your file structure should be like this:
# /src/pages/React
β”œβ”€β”€ Demo
β”‚   β”œβ”€β”€ index.astro
β”‚   └── [your file name].tsx
β”œβ”€β”€ ...
└── Router.astro

Commands

All commands are run from the root of the project, from a terminal:

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:4321
npm run build Build your production site to ./dist/
npm run preview Preview your build locally, before deploying

About

A demo environment that integrates multiple mainstream front-end frameworks, making it easy to learn multiple frameworks in one environment.


Languages

Language:Astro 42.3%Language:JavaScript 22.9%Language:Vue 17.2%Language:CSS 11.1%Language:TypeScript 3.6%Language:HTML 2.9%