Question: The following is the initialized project. The style file in the project is.css. How to change.css to.scss?

Solution: Run the following command:

find . -name "*.css" -exec bash -c 'mv "$1" "${1%.css}".scss' - '{}' \;

Then you’ll see that the console has an error because the.css file that was referenced before is now an.scss file and needs to be modified.

There are two modifications:

1 is the business component

2 is the configuration file for the project.

For business components, change the suffix from.css to.scss. For example:

The project configuration information, in angular.json, is modified as follows:

This modification will resolve some of the console errors. If there are still errors:

If you encounter this error, stop the project and restart it:

This completes the transformation of.css to.scss in the current project.

One thing to keep in mind is that this is a fairly new project and is in the early stages before a large number of third-party libraries are introduced. If a large number of third-party libraries have been introduced, such as font libraries and other libraries that may be style-related, this method may have some limitations and may need to be further modified. Please refer to the reference article cited in this article.

Reference: lanxuexing. Making. IO / 2019/09/26 /…

Summary: This is the same as the route file declared yesterday, but it can be written when initializing the project.

  • One is: when initializing a project, create a routing file
  • One is: when initializing the project, set the format of the style file to be used in the project, be it.css or.scss.