Vite migration (1/3): Go HTML and asset contract
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/answer
-
List button click not working Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Hardening: cap the invite_user list size in UpdateQuestionInviteUser to bound notification fan-out Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Gravatar hash is computed from the un-lowercased email, so mixed-case accounts render an identicon Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Tất cả issue của apache/answer
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug group: validation priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
codecheckers/chekhov#51 ·
-
Creating worktree from an existing remote branch with a slash in it, has unexpected behaviour Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100