Skip to content

Nested sass imports are no longer working #14667

@rrajewski

Description

@rrajewski

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, this worked in version 7.3.9 or in version 8 if you have node-sass installed as a dev dependency.

Description

Overriding sass variables in a nested import no longer works. Instead the last import wins. It works if you copy the contents of the file out and paste in place of the nested import.

🔬 Minimal Reproduction

example:
This does not work

.light-theme {
  @import 'assets/styles/light';
  @import '~highcharts/css/highcharts';
}

.dark-theme {
  @import 'assets/styles/dark';
  @import '~highcharts/css/highcharts';
}

This works

.light-theme {
  $neutral-color-3: blue; // contents of @import 'assets/styles/light';
  @import '~highcharts/css/highcharts';
}

.dark-theme {
  $neutral-color-3: black;  // contents of @import 'assets/styles/dark';
  @import '~highcharts/css/highcharts';
}

example repo: https://github.com/rrajewski/angularcli-sass-nested-import

🌍 Your Environment


Angular CLI: 8.0.1
Node: 10.13.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cli                      8.0.1
@ngtools/webpack                  8.0.1
@schematics/angular               8.0.1
@schematics/update                0.800.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions