Angular 应用程序中的空注释 [英] Empty comments in Angular application

查看:20
本文介绍了Angular 应用程序中的空注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何配置设置可以删除这些空注释和空格?

Is there any configuration setting which would remove these empty comments and whitespace?

我的构建命令是 ng build --environment prod --progress false --target production 和 tsconfig 是:

My build command is ng build --environment prod --progress false --target production and tsconfig is:

{
    "compileOnSave": false,
    "compilerOptions": {
        "alwaysStrict": true,
        "baseUrl": "/",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "forceConsistentCasingInFileNames": true,
        "lib": [ "es2015", "dom" ],
        "module": "es2015",
        "moduleResolution": "node",
        "newLine": "CRLF",
        "noFallthroughCasesInSwitch": true,
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "noUnusedLocals": true,
        "noUnusedParameters": false,
        "outDir": "./dist/out-tsc",
        "removeComments": true,
        "skipDefaultLibCheck": true,
        "skipLibCheck": true,
        "strictNullChecks": true,
        "target": "es5",
        "typeRoots": [ "./node_modules/@types" ]
    }
}

@angular/cli: 1.0.4
节点:7.2.1
操作系统:win32 x64
@angular/common: 4.1.3

@angular/cli: 1.0.4
node: 7.2.1
os: win32 x64
@angular/common: 4.1.3

谢谢.

推荐答案

这是根据你的 Angular 指令、标签、条件(if,for...)生成的,所以这个空格是必需的.如果你删除它,那么它不会表现得很好,所有两种方式的绑定都会消失.这些空间决定您的角度DOM将如何呈现并绑定到模型和变量.还有注释跟踪新 DOM 元素将呈现的位置(如果条件和其他).

This is generated based on your Angular directive, tag, conditions(if,for...), so this blank space is required. If you remove that then it will not behave well all two way bindings will gone away. Those space determine how your angular DOM will render and bind to Model and variables. Also the comment keep track where new DOM element will render(if conditions and other).

请参阅此链接了解更多信息:https://github.com/angular/angular.js/issues/8722

Refer this link for more information: https://github.com/angular/angular.js/issues/8722

这篇关于Angular 应用程序中的空注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆