angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng build/serve --prod ignores scss url imports if angular.json contains more than 1 style file

Open Maximaximum opened this issue 8 years ago • 43 comments

Versions

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


Angular CLI: 6.0.1
Node: 8.9.4
OS: win32 x64
Angular: 6.0.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.1
@angular-devkit/build-angular     0.6.1
@angular-devkit/build-optimizer   0.6.1
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1
@angular/flex-layout              5.0.0-beta.13
@ngtools/webpack                  6.0.1
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • In the styles.scss file, import a file via url:
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
@import url('https://fonts.googleapis.com/icon?family=Material+Icons'); <- here
@import "styles/_var.scss";
@import 'styles/_tables.scss';
...
  • Run ng serve --prod

Observed behavior

The https://fonts.googleapis.com/icon?family=Material+Icons file contents are absent in the output bundles.

If we do the same thing on angular v 5.2.0, the file contents ARE in the bundle. If we do the same thing, but run ng serve without --prod flag, the file contents ARE in the bundle

Desired behavior

The https://fonts.googleapis.com/icon?family=Material+Icons file contents should be present in the output bundle, just like it did in 5.2.0.

Mention any other details that might be useful (optional)

This issue appeared only after I updated angular from v5.2.0 to v6.0.1

Maximaximum avatar May 14 '18 21:05 Maximaximum

facing the same issue for angular 7, Any update on this one.

ganeshjangam avatar Oct 16 '20 06:10 ganeshjangam

Hi all,

Embedding the contents of non local external stylesheets in other css files was an undesired side-effect which was removed in version 6.

In version 11, we added an optimization to inline Google fonts and icons as part of index.html This will improve improve the First Contentful Paint of the application.

See https://github.com/angular/angular-cli/pull/18926 for more context.

alan-agius4 avatar Nov 06 '20 07:11 alan-agius4

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.