This time I will bring you a detailed explanation of the steps for using scss in Angular projects. What are the precautions for using scss in Angular projects. The following is a practical case, let's take a look.
Preface
SCSS is a new syntax introduced by Sass 3. Its syntax is fully compatible with CSS3 and inherits Sass powerful functions. That is, any standard CSS3 stylesheet is a valid SCSS file with the same semantics. In addition, SCSS can also recognize most CSS hacks (some CSS tricks) and browser-specific syntax, such as the ancient IE filter syntax.
Since SCSS is an extension of CSS, all code that works properly in CSS will also work properly in SCSS. In other words, a Sass user only needs to understand how Sass extensions work to fully understand SCSS. Most extensions such as variables, parent references, and directives are identical; the only difference is that SCSS requires semicolons and braces instead of newlines and indentations.
Angular CLI supports a variety of css preprocessing, including:
- ##css
- scss
- less
- sass ##styl (stylus)
- The default value is css.
Angular has two ways to specify css preprocessing. Take scss as an example below:
Specify css preprocessing for new projectsUse --style to specify css preprocessing for new angular projects
ng new my-project --style=scss
Existing projects specify css preprocessingFor existing projects, it also supports modifying css preprocessing.
View .angular-cli.json, there is a statement similar to the following in the defaults configuration item:
"defaults": { "styleExt": "css", "component": {} }
Use the set instruction to modify styleExt
ng set defaults.styleExt scss
If the project uses scss uniformly, It is recommended to change the css file in the project to scss, and remember to also modify the
referenceof other files to the css file. The reference to styles.css is in .angular-cli.json. I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to deal with the 302 status code when axios appearsDetailed explanation of the use of select built-in componentsThe above is the detailed content of Detailed explanation of steps to use scss in Angular project. For more information, please follow other related articles on the PHP Chinese website!

本篇文章继续Angular的学习,带大家了解一下Angular中的元数据和装饰器,简单了解一下他们的用法,希望对大家有所帮助!

本篇文章带大家深入了解一下angular的状态管理器NgRx,介绍一下NgRx的使用方法,希望对大家有所帮助!

angular中怎么使用monaco-editor?下面本篇文章记录下最近的一次业务中用到的 monaco-editor 在 angular 中的使用,希望对大家有所帮助!

本篇文章给大家分享一个Angular实战,了解一下angualr 结合 ng-zorro 如何快速开发一个后台系统,希望对大家有所帮助!

Angular项目过大,怎么合理拆分它?下面本篇文章给大家介绍一下合理拆分Angular项目的方法,希望对大家有所帮助!

怎么自定义angular-datetime-picker格式?下面本篇文章聊聊自定义格式的方法,希望对大家有所帮助!

本篇文章带大家了解一下Angular中的独立组件,看看怎么在Angular中创建一个独立组件,怎么在独立组件中导入已有的模块,希望对大家有所帮助!

Angular Route中怎么提前获取数据?下面本篇文章给大家介绍一下从 Angular Route 中提前获取数据的方法,希望对大家有所帮助!


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
