Skip to content

Can't uglify inline CSS in HTML when ng build --prod #10137

Closed
@Anduin2017

Description

@Anduin2017

Versions

Angular CLI: 1.7.3
Node: 9.9.0
OS: win32 x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.6.2
webpack: 3.11.0

Repro steps

  • Step 1
    Create a new angular app using ng new
  • Step 2
    Create some inline CSS in index.html, like:
<!DOCTYPE html>
<html lang="en">
<head><title>Kahla - Aiursoft</title>
<base href=".">
<link rel="manifest" href="manifest.json"/>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" name="viewport">
</head>
<body>
<app-kahla>
<style>
      .loading {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%
      }

      body {
        background-color: #2391D3
      }

          @keyframes con {
        50% {
          transform: translateY(-.4rem)
        }
        100% {
          transform: translateY(0)
        }
      }

      .d {
        animation: con 2.0s ease-out infinite
      }

      .d-2 {
        animation-delay: .5s
      }

      .d-3 {
        animation-delay: 1s
      }
</style>
<h1 class="loading">Loading Kahla 
<span class="d">.</span>
 <span class="d d-2">.</span>
 <span class="d d-3">.</span>
</h1>
</app-kahla>
</html>
  • Step 3
    Execute to build
 ng build --prod

Observed behavior

The output of built index.html is uglified(Compressed).
The output of built index.html is using the CSS where was input and not uglified(Compressed).

Desired behavior

The output of built index.html should use uglified(Compressed) CSS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions