Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Vite migration (1/3): Go HTML and asset contract

Đang mở
#1,579 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, vite
Lĩnh vực
backend, build-system, frontend

Hướng nghiên cứu

Bắt đầu với internal/controller/template_controller.go và ui/template/header.html, sau đó kiểm tra TestGetStyleResolvesBuiltAssets mới so với bản build được nhúng. Chạy bản build phát triển của frontend, tiếp theo là go build ./..., go vet ./... và bài kiểm tra asset. Hoàn tất có nghĩa là các thẻ asset đã được phân tích cú pháp được phân giải bất kể thứ tự thuộc tính, nhiều đường dẫn stylesheet được render và các trang được phục vụ vẫn giữ lại một stylesheet cùng các script kiểu cổ điển.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Part of #1578. First step of the series; can land while Create React App still builds.

Problem. internal/controller/template_controller.go GetStyle() scrapes the script and stylesheet paths out of the built ui/build/index.html with regexes that require classic scripts with defer first and stylesheet links with href before rel, and it returns a single stylesheet path. Every server-rendered page reuses those paths through ui/template/header.html. Any other tag shape returns nothing, and the pages load with no JavaScript and no stylesheet while every build step still reports success. Nothing in the tree asserts the contract.

Change. Read the tags from the parsed document (golang.org/x/net/html), so attribute order, attribute set and quoting no longer matter. Return cssPath as a list, mirroring how script paths are already collected and prefixed, and range over it in header.html. Add TestGetStyleResolvesBuiltAssets, which calls the real GetStyle() against the real embedded build and skips when no build is embedded. Keep the classic <script defer="defer" src=...> tag in header.html; the module switch belongs to step 2.

Done when. dev with only this change builds the frontend with the current toolchain, go build ./... and go vet ./... pass, the test passes against that build, and the served pages are unchanged (one stylesheet, classic scripts).

Ngôn ngữ chính
Go
Star
15.7k
Fork
1.4k
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
6

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/answer

Tất cả issue của apache/answer

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.