Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Flatten glob "assets" to one output folder

Aperta
#14,158 11 commenti 9 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
angular, typescript
Ambito
build-system, cli

Direzione di ricerca

Inizia dalla configurazione dell’esportazione degli asset e confronta il modo in cui ng serve, ng build --watch e una build normale elaborano il glob mostrato. La modifica è completata quando gli asset annidati possono essere emessi direttamente sotto dist/assets senza le cartelle intermedie module e assets, rimanendo disponibili anche per il workflow di serve in memoria.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
27k
Fork
11.8k
Merge medio
17h 25m
PR unite (30g)
183

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angular-cli

Tutte le issue di angular/angular-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.