For more information, see Angular-cli to generate components and change css to less or sass instances.
Details about Angular-cli generation component modification of css to less or sass instances
Use cli commands to generate components:
Ng generate component name
The generated component files include html, ts, css, and spec. ts.
The problem is, how can I write css for a less severe patient.
Therefore, when I want to use cli to generate components, the less file instead of the css file can be generated directly;
Modify the angular-cli.json file:
Apps "styles": ["styles. less"] "defaults": "styleExt": "less ",
In this way, you can replace the css file with the less file when using component commands.
However, angularcode reports an error. modify all. CSS files to a. less file.
Change the css in styleUrls referenced in the ts file to less
No error is reported when editing the cli.
Less compilation problems:
Less-loader
The operations on sass files are the same as above.
The above is an example of Angular-cli component generation to change css to less or sass. If you have any questions, please leave a message or go to the community on this site for discussion. There are still many articles on AngularJS on this site, you are welcome to search for it. Thank you for reading it. I hope it will help you. Thank you for your support for this site!