Skip to content

Deprecated type attribute in index.html: <style type="text/css"> #27471

Closed

Description

@johnnygerard

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When running ng build with --optimization, the deprecated style element type attribute (type="text/css") is added as part of the critical CSS inlining.
This also causes a warning from the HTML W3C validator.

Minimal Reproduction

  1. Run ng new app --defaults
  2. Add Google font links in src/index.html
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
  1. Add a rule in src/styles.css
body {
  font-family: "Roboto", sans-serif;
}
  1. Run ng build (using the default --optimization flag)
  2. Inspect dist/app/browser/index.html output file for type="text/css"

Exception or Error

No response

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.3.4
Node: 18.20.2
Package Manager: npm 10.5.0
OS: linux x64

Angular: 17.3.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.4
@angular-devkit/build-angular   17.3.4
@angular-devkit/core            17.3.4
@angular-devkit/schematics      17.3.4
@schematics/angular             17.3.4
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.4

Anything else relevant?

No response

Activity

  1. added
    help wanted
    good first issue
    freq1: low
    on Apr 16, 2024
  2. added a commit that references this issue on Apr 16, 2024
    0ddbd90
  3. removed
    help wanted
    good first issue
    on Apr 16, 2024
  4. added 2 commits that reference this issue on Apr 16, 2024
    43816a5
    0335d6a
  5. angular-automatic-lock-bot commented on May 17, 2024

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular-devkit/build-angularfreq1: lowseverity2: inconvenienttype: bug/fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions