For more information, see Angular-cli to generate components and change css to less or sass instances.

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.