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

查看:47
本文介绍了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指令,标记,条件(如果...)生成的,因此需要空白空间>.如果删除它,那么它将无法正常工作,所有两种方式的绑定都将消失.这些空间确定确定您的角度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天全站免登陆