Skip to content

Schematic does not add custom theme #11188

Closed
@jerryorta-dev

Description

@jerryorta-dev

Bug, feature request, or proposal:

When creating a new angular project using version 6.0 fo @angular/cli,
And adding material with a custom theme using the schematic -- ng add @angular/material --theme=custom,
Then a default custom theme should be applied to the file src/styles.scss.

What is the expected behavior?

The stubbed custom theme contents should be added to the file src/styles.scss.

What is the current behavior?

The follow error is thrown in the console: "No style files could be found into which a theme could be added"

What are the steps to reproduce?

In the console:

# create a new project with scss as default stylesheet
ng new test-styles --style=scss

# change directories
cd test-styles

# Use schematic to add material with custom theme
ng add @angular/material --theme=custom

What is the use-case or motivation for changing an existing behavior?

To add a custom theme to my projects.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Node 8.10.0
Angular 6.0.0
Material 6.0.0

Is there anything else we should know?

As a work-around, before adding material, in the angular.json file, change project “styles” to

"styles": [
  {
    "input": "src/styles.scss"
  }
], 

And then it works fine.

The issue appears to be here, which requires src/styles.scss to in an object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions