Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material schematics doesn't work with configured angular schematics (scss, spec, etc...) #11874

Closed
NorDroN opened this issue Jun 21, 2018 · 9 comments · Fixed by #12888
Closed
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@NorDroN
Copy link

NorDroN commented Jun 21, 2018

Bug, feature request, or proposal:

BUG

What is the expected behavior?

When I've configured the CLI to use scss and skip tests for generated components, I would expect the material schematics to use already defined configuration when generating components (such as the dashboard).

What is the current behavior?

When I try to create material-dashboard it is created with .css instead of .scss and with .spec file

What are the steps to reproduce?

ng new <project-name> --style=scss --skip-tests
ng add @angular/[email protected] <-- I use 6.2.1 because https://github.com/angular/material2/issues/11836
ng generate @angular/material:material-dashboard --name dashboard

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

"@angular/animations": "^6.0.0",
"@angular/cdk": "^6.2.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/material": "^6.2.1",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",

"@angular/cli": "~6.0.1",

Is there anything else we should know?

I see that command "ng add @angular/material" add only theme file in angular.json

"styles": [
    {
        "input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
    },
    "src/styles.scss"
],

May be that command has to add schematic too?

"schematics": {
    "@schematics/material:material-dashboard": {
        "styleext": "scss",
        "spec": false
    },
    ....
}
@yogeshgadge
Copy link

yogeshgadge commented Jun 21, 2018

pre-built themes are fully baked themes i.e.e they will be css not scss.
This is intentional. Are you expecting indigo-pink.scss ?

PS: I take it back. I think you are talking about the generated dashboard styles which are css not scss which is the issue.

@NorDroN
Copy link
Author

NorDroN commented Jun 22, 2018

I don't mind that pre-built themes are .css. It's normal. If I want use custom theme I can do it.
But I don't understand why when I try to create new material component (dashboard, nav, etc...) I get component with .css.

@rgant
Copy link

rgant commented Jul 3, 2018

Seems that for now you must specify --styleext scss when generating the schematics components.

The schema.json for this setting just accepts any file extension it seems.

@amcdnl
Copy link
Contributor

amcdnl commented Jul 15, 2018

It should be reading from your cli configuration. Can you verify that?

@amcdnl amcdnl added the needs: clarification The issue does not contain enough information for the team to determine if it is a real bug label Jul 15, 2018
@mackelito
Copy link

Sounds like this is a similar issue as #12881 ?

@devversion devversion assigned devversion and unassigned amcdnl Aug 29, 2018
@devversion devversion added in progress and removed needs: clarification The issue does not contain enough information for the team to determine if it is a real bug labels Aug 29, 2018
@devversion
Copy link
Member

Since 5144aa7, we already respect the stylext default option. I will be working on respecting the following supported default options:

devversion added a commit to devversion/material2 that referenced this issue Aug 29, 2018
… spec option value

If developers create a new Angular CLI project, options like `--skipTests`, `--inlineTemplate` or `--inlineStyle` can be specified. These options will be stored in the workspace config file and will be respected if someone generates another component on the existing project.

Since we technically also generate components, we should respect the default option value for those options if _not_ explicitly specified.

Closes angular#11874.
@devversion devversion added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr and removed in progress labels Aug 29, 2018
devversion added a commit to devversion/material2 that referenced this issue Aug 29, 2018
… spec option value

If developers create a new Angular CLI project, options like `--skipTests`, `--inlineTemplate` or `--inlineStyle` can be specified. These options will be stored in the workspace config file and will be respected if someone generates another component on the existing project.

Since we technically also generate components, we should respect the default option value for those options if _not_ explicitly specified.

Closes angular#11874.
jelbourn pushed a commit that referenced this issue Aug 29, 2018
… spec option value (#12888)

If developers create a new Angular CLI project, options like `--skipTests`, `--inlineTemplate` or `--inlineStyle` can be specified. These options will be stored in the workspace config file and will be respected if someone generates another component on the existing project.

Since we technically also generate components, we should respect the default option value for those options if _not_ explicitly specified.

Closes #11874
@gbraga
Copy link

gbraga commented Sep 7, 2018

What is the current state?
I'm also having the same problem. I only executed two commands:

ng new _my-project_
ng add @ angular / material

And I got this error. What is the official solution?

@johanchouquet
Copy link
Contributor

Hi there,

In Angular v8, I'm still facing this problem. To be noted : I have more than 1 application in my Angular project. I have my initial application in 'src' folder, and the others are in the 'project' folder.

When I do: ng generate @angular/material:nav nav-menu --project=mySecondApp, it generates everything, but uses the 'css' extension by default.

I tried to change the angular.json file, by adding, for the right project, the right schematics, like this:

"schematics" :  {
     "@schematics/material:nav": {
          "styleext": "scss"
     }
}

By default, in my angular.json I have, at the root level :

"schematics": {
     "@schematics/angular:component": {
          "styleext": "scss"
     }
}

So, it should take into account my default preferences for the whole project, right ?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
8 participants