Flatten glob "assets" to one output folder
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 14 giờ 23 phút
- Pull request đã merge (30 ngày)
- 162
Mô tả
# 🚀 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:
```json
{
"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.
```sh
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.
Hướng dẫn đóng góp
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.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- build-system, cli
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100