0

In this web container stackblitz demo if we click on the rendered button element in Chrome Developer tooling we can see the generated styles.css.

Here is a screenshot.

enter image description here

When I try to do the same thing in an Angular CLI project, Angular will serve the styles.scss file, instead of styles.css.

This is a screenshot.

enter image description here

Is there a way to tell Angular to serve styles.css instead of styles.scss when working with local CLI based projects?

3 Answers 3

2

Edge

When you open up styles.scss by clicking on it in the styles tab of your devtools in Edge, you can just select the format you want in the tabs above the stylesheet it presents to you. I you can't see it you can click the >> arrows to show the option in a dropdown.

However, you will only see the global styles there. Not the component styling.

Click on the styles.scss on the right:

enter image description here

Select whatever presentation you prefer in the tabs:

enter image description here

Chrome

Go to devtools settings and disable CSS sourcemaps. (Second column, next to last check mark.)

enter image description here

Now you will see styles.css only in the right of your styles tab.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

If you could screen shot the process that would be awesome. Unfortunately I don't see the >> dropdown option ...
I added pictures for you on how to switch between scss and css in both Edge and Chrome. I like how Edge handles this more. I would think this is similar to how it works on macOS.
0

A few ideas:

  1. When you generate the project; you can tell it to use CSS instead of SCSS. There is probably a way to switch a project from SCSS to CSS within the Angular.json.
  2. If you create and deploy a production build; it should not include source maps; and therefore you'll probably see CSS files in developer tools.

1 Comment

My use case is to be able to experiment with more advanced SASS techniques. I'm also going through the Angular Material SASS Source so I was looking for a way to see what CSS is generated from the SASS. I was hoping, like you say, that there is a way to switch this on in angular.json, so that it allows for a more streamlined development experience ...
0

If I understand correctly, you are trying to serve different stylesheets depending on the configuration you run.

You can configure which global stylesheets to include in your Angular build via the angular.json config file:

https://angular.io/guide/workspace-config#styles-and-scripts-configuration

You can achieve this by creating a configuration for running your project locally and swap the .scss file for the .css file there.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.