Add support for "<%_", "_%>" and "-%>" delimiters in templating in @angular-devkit/core
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 14 h 23 min
- PR mergées (30 j)
- 162
Description
# 🚀 Feature request
### Command (mark with an `x`)
- [x] generate
### Description
The templating for the @angular/devkit library uses EJS, sort of but doesn't support whitespace slurping the way that the documentation of EJS has declared it. Having this would enable schematic templates to be much more flexible with their whitespace and therefor easier to read while still creating nicely formatted files.
### Describe the solution you'd like
The three delimiters: `"<%_"`, `"_%>"` and `"-%>"` should just be added and work the same way that they do in EJS.
I already have an idea of the code that I'd like to add, and a pull request almost ready. It's very simple and only affects one file.
### Examples
Within [@schematics/angular](https://npmjs.com/package/@schematics/angular) this would allow an example like the following
```
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
<%_ if (routing) { %>
import { AppRoutingModule } from './app-routing.module';
<%_ } -%>
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
<%_ if (routing) { -%>
AppRoutingModule,
<%_ } -%>
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```
Which would generate with the correct whitespace.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
L’issue identifie l’implémentation de templating de @angular-devkit/core, mais ne nomme aucun fichier ni test. Commencez par localiser cette implémentation et comparez la gestion de ses délimiteurs avec EJS ; c’est terminé lorsque les délimiteurs qui suppriment les espaces blancs <%, _%> et -%> fonctionnent pour le template schematic montré.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 28/100