我一直在按照本文创建自定义 Angular Schematics:https://medium.com/@tomastrajan/total-guide-to-custom-angular-schematics-5c50cf90cdb4
现在我试图找出如何修改一些文件(例如 app-routing.module.ts,以添加通过我的自定义原理图创建的组件的路由)。是否可以?谁能提供一个例子吗?
我还想同时在不同的位置/文件夹中创建文件。
这是我的自定义原理图的当前结构:
- 源代码
- 桌子
- 文件
- __name@dasherize __-表
- __name@dasherize __-table-routing.module.ts
- __name@dasherize __-table.component.html
- __name@dasherize __-table.component.scss
- ...
- 索引.ts
- 模式.d.ts
- 架构.json
- 集合.json
- ...
这是我当前的代码:
索引.ts
import { strings } from '@angular-devkit/core';
import {
apply, mergeWith, move, Rule, SchematicContext, SchematicsException, template, Tree, url
} from '@angular-devkit/schematics';
import { parseName } from '@schematics/angular/utility/parse-name';
import { buildDefaultPath } from '@schematics/angular/utility/project';
import { Schema } from './schema';
export function tabla(_options: Schema): Rule {
return (tree: Tree, _context: SchematicContext) => {
const workspaceConfigBuffer …Run Code Online (Sandbox Code Playgroud) 我有一个非常定制的 Wordpress 网站,其中有很多贡献者并发布了很多帖子。当您尝试发布/更新自定义帖子时,它会显示一个弹出窗口,提示“如果您离开此页面,您所做的更改将丢失。您确定要离开此页面吗?”。
仅当帖子的修改/新内容位于与“高级自定义字段”插件对应的自定义字段中时,才会发生这种情况。这个弹出窗口对贡献者来说非常烦人。所以我想知道是否可以禁用此弹出窗口或任何解决此问题的方法。
谢谢。