Skip to content

Can't use scss files normally #8034

@palucdev

Description

@palucdev

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

@angular/cli: 1.4.7
node: 6.10.0
os: win32 x64
@angular/animations: 4.3.3
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/material: 2.0.0-beta.8
@angular/cdk: 2.0.0-beta.8
@angular/cli: 1.4.7
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3
typescript: 2.3.4

Repro steps.

I'm struggling to use sass in fresh angular project. I created project with --style=scss flag from CLI and then updated .angular-cli.json file content with "styleExt": "scss" and "styles": ["styles.scss"]. Project building was successfull but styles from files like xyz.component.scss were not compiled and thus not included in styles bundle.

I managed to add components style files to .angular-cli.json file "styles": ["styles.scss", "./path/to/file/xyz.component.scss"] but this resulted in runtime error: Error: Uncaught (in promise): Expected 'styles' to be an array of strings.

To avoid this error I deleted styleUrls: ['./xyz.component.scss'] from @Component annotations in xyz.component.ts files.

Now everything works good but I don't understand whats going on with those scss files. Why I must delete reference to them from @Component? (they are referenced automaticly when using ng g component cli command). Are there any other options to make it work without referencing .scss files in .angular-cli.json and use @Component reference instead?

Metadata

Metadata

Assignees

Labels

needs: repro stepsWe cannot reproduce the issue with the information given

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions