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

Add support for "<%_", "_%>" and "-%>" delimiters in templating in @angular-devkit/core

Đang mở
#23,169 2 bình luận 5 reaction 0 người được giao Xem trên GitHub

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
28/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ệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Issue xác định phần triển khai templating của @angular-devkit/core, nhưng không nêu tên file hoặc test nào. Hãy bắt đầu bằng cách tìm phần triển khai đó và so sánh cách xử lý delimiter của nó với EJS; hoàn thành khi các delimiter loại bỏ khoảng trắng <%, _%> và -%> hoạt động với schematic template được hiển thị.

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

Mô tả

area: @angular-devkit/core feature feature: in backlog

🚀 Feature request

Command (mark with an 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 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.

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

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.