Study Guide: Project Setup & Tools
VS Code Setup
Section titled “VS Code Setup”VS Code คือ code editor ที่นักพัฒนาส่วนใหญ่ใช้ — ฟรี, เร็ว, มี extensions เยอะมาก
- ไปที่ code.visualstudio.com
- ดาวน์โหลดตาม OS (Mac / Windows / Linux)
- เปิดแล้วติดตั้ง extensions ด้านล่าง
Extensions ที่ต้องมี
Section titled “Extensions ที่ต้องมี”| Extension | ทำอะไร |
|---|---|
| Prettier | จัดรูปแบบโค้ดให้สวยอัตโนมัติ |
| Live Server | เปิดหน้าเว็บแล้วรีเฟรชอัตโนมัติเมื่อบันทึก |
| Auto Rename Tag | เปลี่ยนชื่อ tag เปิด tag ปิดจะเปลี่ยนตาม |
| Thai Language Pack | แปลเมนูเป็นภาษาไทย (optional) |
Settings ที่แนะนำ
Section titled “Settings ที่แนะนำ”กด Cmd + , เปิด Settings
กด Ctrl + , เปิด Settings
{ "editor.formatOnSave": true, "editor.tabSize": 2, "editor.wordWrap": "on", "editor.minimap.enabled": false}File & Folder Organization
Section titled “File & Folder Organization”ตั้งชื่อไฟล์ยังไงดี?
Section titled “ตั้งชื่อไฟล์ยังไงดี?”Directorymy-project/
- index.html ใช้ lowercase + dash
- style.css ชื่อสื่อความหมาย
- script.js สั้น กระชับ
กฎตั้งชื่อ
Section titled “กฎตั้งชื่อ”- ใช้ lowercase เสมอ
- ใช้ dash (-) แทน space
- ชื่อต้อง สื่อความหมาย (ไม่ใช่ test1.html, aaa.css)
- ทุกโปรเจกต์เริ่มจาก
index.htmlเป็นหน้าหลัก
นามสกุลไฟล์
Section titled “นามสกุลไฟล์”| นามสกุล | คืออะไร |
|---|---|
.html | โครงสร้างหน้าเว็บ |
.css | ตกแต่ง style |
.js | ใส่ logic + interactive |
.json | เก็บข้อมูล config |
.md | เขียนเอกสาร (README) |
Terminal Basics
Section titled “Terminal Basics”Terminal คือที่ที่เราพิมพ์คำสั่งแทนการคลิก — เปิดได้ใน VS Code โดยกด Ctrl + `
คำสั่งพื้นฐาน
Section titled “คำสั่งพื้นฐาน”# ดูว่าอยู่ที่ไหนpwd
# ดูไฟล์ในโฟลเดอร์ปัจจุบันls
# เข้าไปในโฟลเดอร์cd my-project
# ย้อนกลับ 1 ขั้นcd ..
# สร้างโฟลเดอร์ใหม่mkdir my-project
# สร้างไฟล์ใหม่touch index.html
# เคลียร์หน้าจอclearตัวอย่าง: สร้างโปรเจกต์ใหม่
Section titled “ตัวอย่าง: สร้างโปรเจกต์ใหม่”mkdir hello-worldcd hello-worldtouch index.html style.csscode . # เปิดโฟลเดอร์ใน VS CodeGit Basics
Section titled “Git Basics”Git คือ version control — เหมือนกด Save Game ในเกม กลับไปจุดเดิมได้เสมอ
วงจรของ Git
Section titled “วงจรของ Git”คำสั่งที่ใช้บ่อย
Section titled “คำสั่งที่ใช้บ่อย”# เริ่มใช้ Git ในโปรเจกต์git init
# ดูสถานะ (ไฟล์ไหนเปลี่ยน, ไหนยังไม่ track)git status
# เพิ่มไฟล์เข้า staginggit add index.html # เพิ่มไฟล์เดียวgit add . # เพิ่มทุกไฟล์
# บันทึก (commit)git commit -m "add homepage"
# ดูประวัติgit log --onelineเชื่อมกับ GitHub
Section titled “เชื่อมกับ GitHub”# เชื่อม local กับ remote (ทำครั้งแรกครั้งเดียว)git remote add origin https://github.com/username/repo-name.git
# Push โค้ดขึ้น GitHubgit push -u origin main.gitignore
Section titled “.gitignore”สร้างไฟล์ .gitignore เพื่อบอก Git ว่าไฟล์ไหนไม่ต้อง track:
node_modules/.DS_Store*.log.envGitHub & Deploy
Section titled “GitHub & Deploy”สร้าง Repository บน GitHub
Section titled “สร้าง Repository บน GitHub”- ไปที่ github.com แล้ว sign up / login
- กดปุ่ม New สร้าง repository ใหม่
- ตั้งชื่อ repo (เช่น
hello-world) - อย่า ติ๊ก “Add a README” (เพราะเรามีไฟล์แล้ว)
- กด Create repository
- ทำตามคำสั่งที่ GitHub แสดง (git remote add + git push)
Deploy ด้วย GitHub Pages
Section titled “Deploy ด้วย GitHub Pages”- ไปที่ Settings ของ repository
- เลือก Pages ในเมนูซ้าย
- ที่ Source เลือก Deploy from a branch
- เลือก branch main แล้วกด Save
- รอ 1-2 นาที เว็บจะขึ้นที่
https://username.github.io/repo-name
Browser DevTools
Section titled “Browser DevTools”DevTools คือเครื่องมือตรวจสอบหน้าเว็บที่ซ่อนอยู่ใน browser
เปิดด้วย Cmd + Option + I หรือ F12
เปิดด้วย Ctrl + Shift + I หรือ F12
Elements Panel — ตรวจสอบ HTML/CSS
Section titled “Elements Panel — ตรวจสอบ HTML/CSS”- ดูโครงสร้าง HTML ของหน้าเว็บ
- แก้ไข CSS ได้แบบ live (ไม่กระทบไฟล์จริง)
- ดู Box Model (margin, border, padding, content)
- คลิกขวาที่ element > Inspect
Console Panel — ดู JavaScript
Section titled “Console Panel — ดู JavaScript”// ลองพิมพ์ใน Consoledocument.titledocument.querySelector("h1").textContent2 + 2Responsive Mode — ทดสอบหน้าจอต่างขนาด
Section titled “Responsive Mode — ทดสอบหน้าจอต่างขนาด”กดปุ่มรูปมือถือ (หรือ Cmd + Shift + M) เพื่อจำลอง��น้าจอ mobile, tablet, desktop
How the Web Works
Section titled “How the Web Works”เว็บทำงานยังไง?
Section titled “เว็บทำงานยังไง?”บทบาทของแต่ละภาษา
Section titled “บทบาทของแต่ละภาษา”| ภาษา | บทบาท | เปรียบเทียบ |
|---|---|---|
| HTML | โครงสร้าง | โครงกระดูก |
| CSS | ตกแต่ง | เสื้อผ้า, แต่งหน้า |
| JavaScript | พฤติกรรม | กล้ามเนื้อ, การเคลื่อนไหว |
Best Practices
Section titled “Best Practices”การตั้งชื่อไฟล์
Section titled “การตั้งชื่อไฟล์”my-portfolio/index.html ← lowercase, dash, สื่อความหมายGit Commit Messages
Section titled “Git Commit Messages”# Good — บอกว่าทำอะไร สั้นกระชับgit commit -m "add navigation bar"git commit -m "fix responsive layout on mobile"git commit -m "update hero section text"เมื่อไหร่ควร Commit?
Section titled “เมื่อไหร่ควร Commit?”- ทำฟีเจอร์เสร็จ 1 อัน → commit
- แก้ bug เสร็จ → commit
- อย่า commit ทีเดียวทั้งโปรเจกต์ — แบ่ง commit ย่อยๆ