diff --git a/aio/content/guide/angular-compiler-options.md b/aio/content/guide/angular-compiler-options.md index ecdeacc0c8..0dad034e59 100644 --- a/aio/content/guide/angular-compiler-options.md +++ b/aio/content/guide/angular-compiler-options.md @@ -103,7 +103,7 @@ This allows `$localize` messages in application code to use the same id as ident Enables the [Ivy](guide/ivy) compilation and rendering pipeline. Default is `true`, as of version 9. In version 9, you can [opt out of Ivy](guide/ivy#opting-out-of-angular-ivy) to continue using the previous compiler, View Engine. -For library projects generated with the CLI, the `prod` configuration default is `false` in version 9. +For library projects generated with the CLI, the production configuration default is `false` in version 9. ### `enableResourceInlining` @@ -111,7 +111,7 @@ When `true`, replaces the `templateUrl` and `styleUrls` property in all `@Compon When enabled, the `.js` output of `ngc` does not include any lazy-loaded template or style URLs. -For library projects generated with the CLI, the dev configuration default is `true`. +For library projects generated with the CLI, the development configuration default is `true`. {@a enablelegacytemplate} @@ -184,7 +184,7 @@ When `true`, does not emit `.ngfactory.js` and `.ngstyle.js` files. This turns o Can be used to instruct the template compiler to produce `.metadata.json` files for distribution with an `npm` package while avoiding the production of `.ngfactory.js` and `.ngstyle.js` files that cannot be distributed to `npm`. -For library projects generated with the CLI, the dev configuration default is `true`. +For library projects generated with the CLI, the development configuration default is `true`. ### `strictMetadataEmit` @@ -202,7 +202,7 @@ If the client of a library intends to use a symbol in an annotation, the templat This option allows detection of these errors during the build phase of the library and is used, for example, in producing Angular libraries themselves. -For library projects generated with the CLI, the dev configuration default is `true`. +For library projects generated with the CLI, the development configuration default is `true`. ### `strictInjectionParameters` diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index 9e8a7f67c8..fce4ec0735 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -18,14 +18,14 @@ Here are some reasons you might want to use AOT. * *Faster rendering* With AOT, the browser downloads a pre-compiled version of the application. - The browser loads executable code so it can render the application immediately, without waiting to compile the app first. + The browser loads executable code so it can render the application immediately, without waiting to compile the application first. * *Fewer asynchronous requests* The compiler _inlines_ external HTML templates and CSS style sheets within the application JavaScript, eliminating separate ajax requests for those source files. * *Smaller Angular framework download size* - There's no need to download the Angular compiler if the app is already compiled. + There's no need to download the Angular compiler if the application is already compiled. The compiler is roughly half of Angular itself, so omitting it dramatically reduces the application payload. * *Detect template errors earlier* @@ -43,10 +43,10 @@ Here are some reasons you might want to use AOT. Angular offers two ways to compile your application: -* **_Just-in-Time_ (JIT)**, which compiles your app in the browser at runtime. This was the default until Angular 8. -* **_Ahead-of-Time_ (AOT)**, which compiles your app and libraries at build time. This is the default since Angular 9. +* **_Just-in-Time_ (JIT)**, which compiles your application in the browser at runtime. This was the default until Angular 8. +* **_Ahead-of-Time_ (AOT)**, which compiles your application and libraries at build time. This is the default since Angular 9. -When you run the [`ng build`](cli/build) (build only) or [`ng serve`](cli/serve) (build and serve locally) CLI commands, the type of compilation (JIT or AOT) depends on the value of the `aot` property in your build configuration specified in `angular.json`. By default, `aot` is set to `true` for new CLI apps. +When you run the [`ng build`](cli/build) (build only) or [`ng serve`](cli/serve) (build and serve locally) CLI commands, the type of compilation (JIT or AOT) depends on the value of the `aot` property in your build configuration specified in `angular.json`. By default, `aot` is set to `true` for new CLI applications. See the [CLI command reference](cli) and [Building and serving Angular apps](guide/build) for more information. diff --git a/aio/content/guide/build.md b/aio/content/guide/build.md index 86809fbefa..5b6cae399c 100644 --- a/aio/content/guide/build.md +++ b/aio/content/guide/build.md @@ -198,7 +198,7 @@ Specify size values in the following formats: * 12%: Percentage of size relative to baseline. (Not valid for baseline values.) -When you configure a budget, the build system warns or reports an error when a given part of the app reaches or exceeds a boundary size that you set. +When you configure a budget, the build system warns or reports an error when a given part of the application reaches or exceeds a boundary size that you set. Each budget entry is a JSON object with the following properties: @@ -217,7 +217,7 @@ Each budget entry is a JSON object with the following properties: * `bundle` - The size of a specific bundle. * `initial` - The size of JavaScript needed for bootstrapping the application. Defaults to warning @ 500kb and erroring at 1mb. * `allScript` - The size of all scripts. -* `all` - The size of the entire app. +* `all` - The size of the entire application. * `anyComponentStyle` - This size of any one component stylesheet. Defaults to warning at 2kb and erroring at 4kb. * `anyScript` - The size of any one script. * `any` - The size of any file. @@ -291,12 +291,68 @@ To disable these warnings, you can add the CommonJS module name to `allowedCommo }, +{@a browser-compat} + +## Configuring browser compatibility + +The CLI uses [Autoprefixer](https://github.com/postcss/autoprefixer) to ensure compatibility with different browser and browser versions. +You may find it necessary to target specific browsers or exclude certain browser versions from your build. + +Internally, Autoprefixer relies on a library called [Browserslist](https://github.com/browserslist/browserslist) to figure out which browsers to support with prefixing. +Browserlist looks for configuration options in a `browserslist` property of the package configuration file, or in a configuration file named `.browserslistrc`. +Autoprefixer looks for the `browserslist` configuration when it prefixes your CSS. + +* You can tell Autoprefixer what browsers to target by adding a browserslist property to the package configuration file, `package.json`: +``` + "browserslist": [ + "> 1%", + "last 2 versions" + ] +``` + +* Alternatively, you can add a new file, `.browserslistrc`, to the project directory, that specifies browsers you want to support: +``` + ### Supported Browsers + > 1% + last 2 versions +``` + +See the [browserslist repo](https://github.com/browserslist/browserslist) for more examples of how to target specific browsers and versions. + +### Backward compatibility with Lighthouse + +If you want to produce a progressive web application and are using [Lighthouse](https://developers.google.com/web/tools/lighthouse/) to grade the project, add the following `browserslist` entry to your `package.json` file, in order to eliminate the [old flexbox](https://developers.google.com/web/tools/lighthouse/audits/old-flexbox) prefixes: + +``` +"browserslist": [ + "last 2 versions", + "not ie <= 10", + "not ie_mob <= 10" +] +``` + +### Backward compatibility with CSS grid + +CSS grid layout support in Autoprefixer, which was previously on by default, is off by default in Angular 8 and higher. + +To use CSS grid with Internet Explorer 10/11, you must explicitly enable it using the `autoplace` option. +To do this, add the following to the top of the global styles file (or within a specific css selector scope): + +``` +/* autoprefixer grid: autoplace */ +``` +or +``` +/* autoprefixer grid: no-autoplace */ +``` + +For more information, see [Autoprefixer documentation](https://autoprefixer.github.io/). {@a proxy} ## Proxying to a backend server -You can use the [proxying support](https://webpack.js.org/configuration/dev-server/#devserverproxy) in the `webpack` dev server to divert certain URLs to a backend server, by passing a file to the `--proxy-config` build option. +You can use the [proxying support](https://webpack.js.org/configuration/dev-server/#devserverproxy) in the `webpack` development server to divert certain URLs to a backend server, by passing a file to the `--proxy-config` build option. For example, to divert all calls for `http://localhost:4200/api` to a server running on `http://localhost:3000/api`, take the following steps. 1. Create a file `proxy.conf.json` in your project's `src/` folder. @@ -324,7 +380,7 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run ... ``` -1. To run the dev server with this proxy configuration, call `ng serve`. +1. To run the development server with this proxy configuration, call `ng serve`. You can edit the proxy configuration file to add configuration options; some examples are given below. For a description of all options, see [webpack DevServer documentation](https://webpack.js.org/configuration/dev-server/#devserverproxy). diff --git a/aio/content/guide/language-service.md b/aio/content/guide/language-service.md index ba0ec323ee..769c139be9 100644 --- a/aio/content/guide/language-service.md +++ b/aio/content/guide/language-service.md @@ -57,7 +57,7 @@ In this example, Angular doesn't know what `orders` is or where it comes from. ### Quick info and navigation -The quick-info feature allows you to hover to see where components, directives, modules, and so on come from. +The quick-info feature allows you to hover to see where components, directives, and modules come from. You can then click "Go to definition" or press F12 to go directly to the definition.