-
Notifications
You must be signed in to change notification settings - Fork 12k
components cant support scss #7719
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
Comments
Having the same issue. How did this bug slip through the unit tests? |
@avatsaev but its not good 😫
|
@mm580486 you could just change css extension to scss manually, as long as your .angulat-cli.json specifies scss extension for styles, you should be fine |
i changed angular-cli man but not working scss only work on styles.css
|
Could one of you guys provide a repo with this issue so I can take a look at the issue, can't seem to reproduce it on my own build, thanks! |
@RicardoVaranda quite simple to reproduce, using cli 1.4.2 do: ng new web --prefix "i" --style "scss"
cd web
ng g component home The output will be:
Notice the |
Closing as a duplicate |
I don't think the original post is a duplicate of the above mentioned reports. I've been experiencing this for a while now as well, and working around it. As indicated by others, I create a new Angular CLI project, change the angular cli settings to use SCSS instead of CSS, rename styles.css to styles.scss, and app.component.css to app.component.scss. I run the app, and all the SCSS is compiled to CSS and delivered to the browser. I can even generate a new "home" component for the app, and it creates it as a .scss file. But here's the problem: Any styling I put into the home.component.scss file never reaches the browser. On the other hand, if I add a child component to the home page, suddenly, all the home.component.scss gets to the browser now. But the new child component styles do not. It's like the compiler doesn't get to the very last level of scss to send to the client. EDIT: Interesting enough, if you import the scss into either the styles.scss or app.component.scss, it compiles and loads just fine. I believe that was mentioned previously as well. |
@CraigWarford agreed. It seems like out of the box, without any tweaking, All |
This works @angular/cli 6.0.8
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
...
}
}
} |
@chris31389 i only found [email protected] How to get 6.0.8? |
@ihsanberahim If that's a valid v then |
|
I found below answer on Stack Overflow and it worked for me.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
i use scss on project(src directory) and works fine but on components scss not working (but css works fine !)
i started project with
ng new ex --styles= scss
command andstyles.scss
works goodhome.component.ts
tsconfig.app.json
Versions.
The text was updated successfully, but these errors were encountered: