question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incosistency of styling between development and production build

See original GitHub issue

Bug encountered:

I’m experiencing an inconsistent behavior regarding the styling of the form fields. In my application I styled the standard components mat-input-flex mat-form-field-flex class through ::ng-deep like so: form_styled

mat-form-field {
  &.mat-form-field {
    font-family: $body_font;
  }

  ::ng-deep .mat-form-field-flex,
  ::ng-deep .mat-input-flex {
    background-color: #f0f0ff !important;
    padding: 0 12px !important;
    box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  }

and that works fine in my development environment. When I do build the application for production (with Angular CLI through ng build --prod) those styles don’t get applied anymore. form_unstyled I’m not entirely sure if it’s an issue with material or with the cli.

What is the expected behavior?

The styles produced in development should match the ones in production.

Versions

Tested on Chrome 62 and Firefox Quantum 57

Angular CLI: 1.5.5
Node: 8.9.1
OS: linux x64
Angular: 5.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.0.0-rc0
@angular/cli: 1.5.5
@angular/material: 5.0.0-rc0
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.38
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.5
@schematics/angular: 0.1.8
typescript: 2.4.2
webpack: 3.8.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
PrinzJulianocommented, Feb 9, 2018

I can confirm that ng build --prod --build-optimizer=false works perfectly fine when you struggle to built your ng app with just ng build --prod

2reactions
clydincommented, Jan 24, 2018

1.7 has a new stylesheet optimization pipeline. You can try it in the current betas (latest is 1.7.0-beta.1).

Read more comments on GitHub >

github_iconTop Results From Across the Web

inconsistency in 'ng build' vs 'ng build --prod' - Stack Overflow
I am working on an angular app. Using. Angular 5.2.5; Angular CLI 1.6.8. When I executed command ng build. I did not ...
Read more >
How does code style inconsistency affect pull request ...
In this paper, we performed an exploratory analysis on the effect of code style on PR inte- gration in GitHub. We modeled the...
Read more >
Overview | Deploying to Production | Hilla Docs
The main difference between development and production modes is that, in the development mode, Hilla uses webpack to serve JavaScript files ...
Read more >
Making Inconsistency Respectable in Software Development
Regardless, the classification of inconsistency management actions from the earlier work (Nuseibeh et al. 2001 ) is still useful for our ...
Read more >
Reboot, Resets, and Reasoning - CSS-Tricks
... to build upon. If you're new to CSS development, the whole idea of a CSS reset is to deal with styling inconsistencies...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found