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

Flatten glob "assets" to one output folder

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, typescript
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Bắt đầu với cấu hình xuất asset và so sánh cách ng serve, ng build --watch và một bản build thông thường xử lý glob được nêu. Thay đổi được hoàn tất khi các asset lồng nhau có thể được xuất trực tiếp dưới dist/assets mà không có các thư mục module và assets trung gian, đồng thời vẫn khả dụng cho quy trình serve trong bộ nhớ.

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

Mô tả

area: @angular-devkit/build-angular feature feature: insufficient votes

🚀 Feature request

- [ ] new
- [x] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description

I am currently working with nested assets folder per entity map. Currently, I am using the following assets export settings:

              {
                "glob": "**/assets/**/*",
                "input": "src/app",
                "output": "/assets",
                "ignore": ["**/*.ts"]
              }

Imagine having the following file structure:

src
├── app
|   ├── module-folder
|   |   ├── assets
|   |   │   ├── images
|   |   │   │   └── image1.png
|   ├──other-module-folder
|   |   ├── assets
|   |   │   ├── images
|   |   │   │   └── image2.png
What I get

This would result in the following dist/ file structure:

dir
├── assets
|   ├── module-folder
|   |   ├── assets
|   |   │   ├── images
|   |   │   │   └── image1.png
|   ├──other-module-folder
|   |   ├── assets
|   |   │   ├── images
|   |   │   │   └── image2.png
What I want to have
dir
├── assets
|   ├── image1.png
|   └── image2.png
What I have tried

I have tried to use a custom script to move the assets files manually in a flatten way to the dir folder.

for file in ./src/app/**/assets/**/*.*; do cp "$file" "./dist/assets/$(basename -- "$file")" ;done

This, however, does not work in combination with ng serve as the files are in-memory, and also does not work with the ng build --watch as I am unsure how to activate script after it has been built.


I would love to get some insight into the best approach. Maybe this is simply using an already existing flow. From my point of view, this should be included as functionality, as the nested folder structure strategy seems to be one of the more common approaches.

Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
16 giờ 35 phút
Pull request đã merge (30 ngày)
176

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

Mở hướng dẫn đóng góp

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 angular/angular-cli

Tất cả issue của angular/angular-cli

Issue tương tự

Thêm issue về TypeScript

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.